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



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


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

#define SWIGTYPE_p_IJV swig_types[0]
#define SWIGTYPE_p_NTA_BasicType swig_types[1]
#define SWIGTYPE_p_NTA_LogLevel swig_types[2]
#define SWIGTYPE_p_PyDomain swig_types[3]
#define SWIGTYPE_p_PySparseTensor swig_types[4]
#define SWIGTYPE_p_PyTensorIndex swig_types[5]
#define SWIGTYPE_p_RandomProto__Builder swig_types[6]
#define SWIGTYPE_p_RandomProto__Reader swig_types[7]
#define SWIGTYPE_p_Row swig_types[8]
#define SWIGTYPE_p_SparseBinaryMatrixProto__Builder swig_types[9]
#define SWIGTYPE_p_SparseBinaryMatrixProto__Reader swig_types[10]
#define SWIGTYPE_p_SparseMatrixProto__Builder swig_types[11]
#define SWIGTYPE_p_SparseMatrixProto__Reader swig_types[12]
#define SWIGTYPE_p_allocator_type swig_types[13]
#define SWIGTYPE_p_argument_type swig_types[14]
#define SWIGTYPE_p_char swig_types[15]
#define SWIGTYPE_p_difference_type swig_types[16]
#define SWIGTYPE_p_double swig_types[17]
#define SWIGTYPE_p_f___unsigned_long swig_types[18]
#define SWIGTYPE_p_first_type swig_types[19]
#define SWIGTYPE_p_float swig_types[20]
#define SWIGTYPE_p_int swig_types[21]
#define SWIGTYPE_p_key_type swig_types[22]
#define SWIGTYPE_p_long swig_types[23]
#define SWIGTYPE_p_mapped_type swig_types[24]
#define SWIGTYPE_p_nupic__DistanceToZeroT_float_t swig_types[25]
#define SWIGTYPE_p_nupic__Domain2DT_unsigned_int_t swig_types[26]
#define SWIGTYPE_p_nupic__DomainT_unsigned_int_t swig_types[27]
#define SWIGTYPE_p_nupic__Gaussian2DT_float_t swig_types[28]
#define SWIGTYPE_p_nupic__IsNearlyZeroT_nupic__DistanceToZeroT_nupic__Real32_t_t swig_types[29]
#define SWIGTYPE_p_nupic__LogDiffApprox swig_types[30]
#define SWIGTYPE_p_nupic__LogSumApprox swig_types[31]
#define SWIGTYPE_p_nupic__LoggingException swig_types[32]
#define SWIGTYPE_p_nupic__NearestNeighborT_nupic__SparseMatrixT_nupic__UInt32_nupic__Real32_nupic__Int32_nupic__Real64_nupic__DistanceToZeroT_nupic__Real32_t_t_t swig_types[33]
#define SWIGTYPE_p_nupic__Random swig_types[34]
#define SWIGTYPE_p_nupic__SetT_unsigned_int_unsigned_char_t swig_types[35]
#define SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t swig_types[36]
#define SWIGTYPE_p_nupic__SparseMatrixAlgorithms swig_types[37]
#define SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t swig_types[38]
#define SWIGTYPE_p_nz_index_type swig_types[39]
#define SWIGTYPE_p_p_PyObject swig_types[40]
#define SWIGTYPE_p_p_void swig_types[41]
#define SWIGTYPE_p_parent_type swig_types[42]
#define SWIGTYPE_p_prec_value_type swig_types[43]
#define SWIGTYPE_p_result_type swig_types[44]
#define SWIGTYPE_p_second_type swig_types[45]
#define SWIGTYPE_p_self_type swig_types[46]
#define SWIGTYPE_p_short swig_types[47]
#define SWIGTYPE_p_size_t swig_types[48]
#define SWIGTYPE_p_size_type swig_types[49]
#define SWIGTYPE_p_std__allocatorT_double_t swig_types[50]
#define SWIGTYPE_p_std__allocatorT_float_t swig_types[51]
#define SWIGTYPE_p_std__allocatorT_int_t swig_types[52]
#define SWIGTYPE_p_std__allocatorT_long_t swig_types[53]
#define SWIGTYPE_p_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t swig_types[54]
#define SWIGTYPE_p_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t swig_types[55]
#define SWIGTYPE_p_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t swig_types[56]
#define SWIGTYPE_p_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t swig_types[57]
#define SWIGTYPE_p_std__allocatorT_std__pairT_std__string_const_std__string_t_t swig_types[58]
#define SWIGTYPE_p_std__allocatorT_std__pairT_std__string_std__string_t_t swig_types[59]
#define SWIGTYPE_p_std__allocatorT_std__string_t swig_types[60]
#define SWIGTYPE_p_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t swig_types[61]
#define SWIGTYPE_p_std__allocatorT_unsigned_int_t swig_types[62]
#define SWIGTYPE_p_std__allocatorT_unsigned_long_t swig_types[63]
#define SWIGTYPE_p_std__invalid_argument swig_types[64]
#define SWIGTYPE_p_std__istream swig_types[65]
#define SWIGTYPE_p_std__lessT_std__string_t swig_types[66]
#define SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t swig_types[67]
#define SWIGTYPE_p_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t swig_types[68]
#define SWIGTYPE_p_std__ostream swig_types[69]
#define SWIGTYPE_p_std__pairT_std__string_int_t swig_types[70]
#define SWIGTYPE_p_std__pairT_std__string_std__string_t swig_types[71]
#define SWIGTYPE_p_std__pairT_unsigned_int_double_t swig_types[72]
#define SWIGTYPE_p_std__pairT_unsigned_int_float_t swig_types[73]
#define SWIGTYPE_p_std__pairT_unsigned_int_unsigned_int_t swig_types[74]
#define SWIGTYPE_p_std__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t swig_types[75]
#define SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t swig_types[76]
#define SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t swig_types[77]
#define SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t swig_types[78]
#define SWIGTYPE_p_std__vectorT_long_std__allocatorT_long_t_t swig_types[79]
#define SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t swig_types[80]
#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[81]
#define SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t swig_types[82]
#define SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t swig_types[83]
#define SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t swig_types[84]
#define SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t swig_types[85]
#define SWIGTYPE_p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t swig_types[86]
#define SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t swig_types[87]
#define SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t swig_types[88]
#define SWIGTYPE_p_swig__SwigPyIterator swig_types[89]
#define SWIGTYPE_p_uintptr_t swig_types[90]
#define SWIGTYPE_p_unsigned_int swig_types[91]
#define SWIGTYPE_p_unsigned_long swig_types[92]
#define SWIGTYPE_p_unsigned_short swig_types[93]
#define SWIGTYPE_p_value_type swig_types[94]
static swig_type_info *swig_types[96];
static swig_module_info swig_module = {swig_types, 95, 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):= _math.so
  ------------------------------------------------*/
#if PY_VERSION_HEX >= 0x03000000
#  define SWIG_init    PyInit__math

#else
#  define SWIG_init    init_math

#endif
#define SWIG_name    "_math"

#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"


/* ---------------------------------------------------------------------
 * 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 <cmath>
#include <nupic/types/Types.hpp>
#include <nupic/math/Utils.hpp>
#include <nupic/math/Math.hpp>
#include <nupic/math/Functions.hpp>
#include <nupic/math/ArrayAlgo.hpp>
#include <nupic/proto/RandomProto.capnp.h>
#include <nupic/utils/Random.hpp>
#include <numpy/arrayobject.h>

#include <py_support/PyCapnp.hpp>


#define SWIG_FILE_WITH_INIT


#ifndef SWIG_FILE_WITH_INIT
#  define NO_IMPORT_ARRAY
#endif
#include "stdio.h"
#include <numpy/arrayobject.h>


SWIGINTERNINLINE PyObject*
  SWIG_From_int  (int value)
{
  return PyInt_FromLong((long) 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;
}


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_FromCharPtr(const char *cptr)
{ 
  return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
}


#include <stdexcept>


#if defined(__GNUC__)
#  if __GNUC__ == 2 && __GNUC_MINOR <= 96
#     define SWIG_STD_NOMODERN_STL
#  endif
#endif


#include <string>


#include <stddef.h>


#include <iostream>

#if PY_VERSION_HEX >= 0x03020000
# define SWIGPY_SLICE_ARG(obj) ((PyObject*) (obj))
#else
# define SWIGPY_SLICE_ARG(obj) ((PySliceObject*) (obj))
#endif


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
}


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_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_ptrdiff_t  (ptrdiff_t value)
{    
  return SWIG_From_long  (static_cast< long >(value));
}


SWIGINTERNINLINE PyObject*
  SWIG_From_bool  (bool value)
{
  return PyBool_FromLong(value ? 1 : 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;
}


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;
}


#include <algorithm>


#include <vector>


#include <utility>


#include <map>


#include <algorithm>


#include <list>


#include <set>


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;
  };

}


#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_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;
}


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 <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<int, std::allocator< int > > > {
	  typedef pointer_category category;
	  static const char* type_name() {
	    return "std::vector<" "int" "," "std::allocator< int >" " >";
	  }
	};
      }
    
SWIGINTERN swig::SwigPyIterator *std_vector_Sl_NTA_Int32_Sg__iterator(std::vector< NTA_Int32 > *self,PyObject **PYTHON_SELF){
      return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
    }
SWIGINTERN bool std_vector_Sl_NTA_Int32_Sg____nonzero__(std::vector< NTA_Int32 > const *self){
      return !(self->empty());
    }
SWIGINTERN bool std_vector_Sl_NTA_Int32_Sg____bool__(std::vector< NTA_Int32 > const *self){
      return !(self->empty());
    }
SWIGINTERN std::vector< int >::size_type std_vector_Sl_NTA_Int32_Sg____len__(std::vector< NTA_Int32 > const *self){
      return self->size();
    }

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 std::vector< int >::value_type std_vector_Sl_NTA_Int32_Sg__pop(std::vector< NTA_Int32 > *self){
      if (self->size() == 0)
	throw std::out_of_range("pop from empty container");
      std::vector<int,std::allocator< int > >::value_type x = self->back();
      self->pop_back();
      return x;
    }
SWIGINTERN std::vector< int,std::allocator< int > > *std_vector_Sl_NTA_Int32_Sg____getslice__(std::vector< NTA_Int32 > *self,std::vector< int >::difference_type i,std::vector< int >::difference_type j){
      return swig::getslice(self, i, j, 1);
    }
SWIGINTERN void std_vector_Sl_NTA_Int32_Sg____setslice__(std::vector< NTA_Int32 > *self,std::vector< int >::difference_type i,std::vector< int >::difference_type j,std::vector< int,std::allocator< int > > const &v=std::vector< int,std::allocator< int > >()){
      swig::setslice(self, i, j, 1, v);
    }
SWIGINTERN void std_vector_Sl_NTA_Int32_Sg____delslice__(std::vector< NTA_Int32 > *self,std::vector< int >::difference_type i,std::vector< int >::difference_type j){
      swig::delslice(self, i, j, 1);
    }
SWIGINTERN void std_vector_Sl_NTA_Int32_Sg____delitem____SWIG_0(std::vector< NTA_Int32 > *self,std::vector< int >::difference_type i){
      self->erase(swig::getpos(self,i));
    }
SWIGINTERN std::vector< int,std::allocator< int > > *std_vector_Sl_NTA_Int32_Sg____getitem____SWIG_0(std::vector< NTA_Int32 > *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<int,std::allocator< int > >::difference_type id = i;
      std::vector<int,std::allocator< int > >::difference_type jd = j;
      return swig::getslice(self, id, jd, step);
    }
SWIGINTERN void std_vector_Sl_NTA_Int32_Sg____setitem____SWIG_0(std::vector< NTA_Int32 > *self,PySliceObject *slice,std::vector< int,std::allocator< int > > 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<int,std::allocator< int > >::difference_type id = i;
      std::vector<int,std::allocator< int > >::difference_type jd = j;
      swig::setslice(self, id, jd, step, v);
    }
SWIGINTERN void std_vector_Sl_NTA_Int32_Sg____setitem____SWIG_1(std::vector< NTA_Int32 > *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<int,std::allocator< int > >::difference_type id = i;
      std::vector<int,std::allocator< int > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN void std_vector_Sl_NTA_Int32_Sg____delitem____SWIG_1(std::vector< NTA_Int32 > *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<int,std::allocator< int > >::difference_type id = i;
      std::vector<int,std::allocator< int > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN std::vector< int >::value_type const &std_vector_Sl_NTA_Int32_Sg____getitem____SWIG_1(std::vector< NTA_Int32 > const *self,std::vector< int >::difference_type i){
      return *(swig::cgetpos(self, i));
    }
SWIGINTERN void std_vector_Sl_NTA_Int32_Sg____setitem____SWIG_2(std::vector< NTA_Int32 > *self,std::vector< int >::difference_type i,std::vector< int >::value_type const &x){
      *(swig::getpos(self,i)) = x;
    }
SWIGINTERN void std_vector_Sl_NTA_Int32_Sg__append(std::vector< NTA_Int32 > *self,std::vector< int >::value_type const &x){
      self->push_back(x);
    }
SWIGINTERN std::vector< int >::iterator std_vector_Sl_NTA_Int32_Sg__erase__SWIG_0(std::vector< NTA_Int32 > *self,std::vector< int >::iterator pos){ return self->erase(pos); }
SWIGINTERN std::vector< int >::iterator std_vector_Sl_NTA_Int32_Sg__erase__SWIG_1(std::vector< NTA_Int32 > *self,std::vector< int >::iterator first,std::vector< int >::iterator last){ return self->erase(first, last); }
SWIGINTERN std::vector< int >::iterator std_vector_Sl_NTA_Int32_Sg__insert__SWIG_0(std::vector< NTA_Int32 > *self,std::vector< int >::iterator pos,std::vector< int >::value_type const &x){ return self->insert(pos, x); }
SWIGINTERN void std_vector_Sl_NTA_Int32_Sg__insert__SWIG_1(std::vector< NTA_Int32 > *self,std::vector< int >::iterator pos,std::vector< int >::size_type n,std::vector< int >::value_type const &x){ self->insert(pos, n, x); }

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


      namespace swig {
	template <>  struct traits<std::vector<long, std::allocator< long > > > {
	  typedef pointer_category category;
	  static const char* type_name() {
	    return "std::vector<" "long" "," "std::allocator< long >" " >";
	  }
	};
      }
    
SWIGINTERN swig::SwigPyIterator *std_vector_Sl_NTA_Int64_Sg__iterator(std::vector< NTA_Int64 > *self,PyObject **PYTHON_SELF){
      return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
    }
SWIGINTERN bool std_vector_Sl_NTA_Int64_Sg____nonzero__(std::vector< NTA_Int64 > const *self){
      return !(self->empty());
    }
SWIGINTERN bool std_vector_Sl_NTA_Int64_Sg____bool__(std::vector< NTA_Int64 > const *self){
      return !(self->empty());
    }
SWIGINTERN std::vector< long >::size_type std_vector_Sl_NTA_Int64_Sg____len__(std::vector< NTA_Int64 > const *self){
      return self->size();
    }
SWIGINTERN std::vector< long >::value_type std_vector_Sl_NTA_Int64_Sg__pop(std::vector< NTA_Int64 > *self){
      if (self->size() == 0)
	throw std::out_of_range("pop from empty container");
      std::vector<long,std::allocator< long > >::value_type x = self->back();
      self->pop_back();
      return x;
    }
SWIGINTERN std::vector< long,std::allocator< long > > *std_vector_Sl_NTA_Int64_Sg____getslice__(std::vector< NTA_Int64 > *self,std::vector< long >::difference_type i,std::vector< long >::difference_type j){
      return swig::getslice(self, i, j, 1);
    }
SWIGINTERN void std_vector_Sl_NTA_Int64_Sg____setslice__(std::vector< NTA_Int64 > *self,std::vector< long >::difference_type i,std::vector< long >::difference_type j,std::vector< long,std::allocator< long > > const &v=std::vector< long,std::allocator< long > >()){
      swig::setslice(self, i, j, 1, v);
    }
SWIGINTERN void std_vector_Sl_NTA_Int64_Sg____delslice__(std::vector< NTA_Int64 > *self,std::vector< long >::difference_type i,std::vector< long >::difference_type j){
      swig::delslice(self, i, j, 1);
    }
SWIGINTERN void std_vector_Sl_NTA_Int64_Sg____delitem____SWIG_0(std::vector< NTA_Int64 > *self,std::vector< long >::difference_type i){
      self->erase(swig::getpos(self,i));
    }
SWIGINTERN std::vector< long,std::allocator< long > > *std_vector_Sl_NTA_Int64_Sg____getitem____SWIG_0(std::vector< NTA_Int64 > *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<long,std::allocator< long > >::difference_type id = i;
      std::vector<long,std::allocator< long > >::difference_type jd = j;
      return swig::getslice(self, id, jd, step);
    }
SWIGINTERN void std_vector_Sl_NTA_Int64_Sg____setitem____SWIG_0(std::vector< NTA_Int64 > *self,PySliceObject *slice,std::vector< long,std::allocator< long > > 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<long,std::allocator< long > >::difference_type id = i;
      std::vector<long,std::allocator< long > >::difference_type jd = j;
      swig::setslice(self, id, jd, step, v);
    }
SWIGINTERN void std_vector_Sl_NTA_Int64_Sg____setitem____SWIG_1(std::vector< NTA_Int64 > *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<long,std::allocator< long > >::difference_type id = i;
      std::vector<long,std::allocator< long > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN void std_vector_Sl_NTA_Int64_Sg____delitem____SWIG_1(std::vector< NTA_Int64 > *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<long,std::allocator< long > >::difference_type id = i;
      std::vector<long,std::allocator< long > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN std::vector< long >::value_type const &std_vector_Sl_NTA_Int64_Sg____getitem____SWIG_1(std::vector< NTA_Int64 > const *self,std::vector< long >::difference_type i){
      return *(swig::cgetpos(self, i));
    }
SWIGINTERN void std_vector_Sl_NTA_Int64_Sg____setitem____SWIG_2(std::vector< NTA_Int64 > *self,std::vector< long >::difference_type i,std::vector< long >::value_type const &x){
      *(swig::getpos(self,i)) = x;
    }
SWIGINTERN void std_vector_Sl_NTA_Int64_Sg__append(std::vector< NTA_Int64 > *self,std::vector< long >::value_type const &x){
      self->push_back(x);
    }
SWIGINTERN std::vector< long >::iterator std_vector_Sl_NTA_Int64_Sg__erase__SWIG_0(std::vector< NTA_Int64 > *self,std::vector< long >::iterator pos){ return self->erase(pos); }
SWIGINTERN std::vector< long >::iterator std_vector_Sl_NTA_Int64_Sg__erase__SWIG_1(std::vector< NTA_Int64 > *self,std::vector< long >::iterator first,std::vector< long >::iterator last){ return self->erase(first, last); }
SWIGINTERN std::vector< long >::iterator std_vector_Sl_NTA_Int64_Sg__insert__SWIG_0(std::vector< NTA_Int64 > *self,std::vector< long >::iterator pos,std::vector< long >::value_type const &x){ return self->insert(pos, x); }
SWIGINTERN void std_vector_Sl_NTA_Int64_Sg__insert__SWIG_1(std::vector< NTA_Int64 > *self,std::vector< long >::iterator pos,std::vector< long >::size_type n,std::vector< long >::value_type const &x){ self->insert(pos, n, x); }

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;
}


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


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 >" " >";
	  }
	};
      }
    
SWIGINTERN swig::SwigPyIterator *std_vector_Sl_NTA_UInt32_Sg__iterator(std::vector< NTA_UInt32 > *self,PyObject **PYTHON_SELF){
      return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
    }
SWIGINTERN bool std_vector_Sl_NTA_UInt32_Sg____nonzero__(std::vector< NTA_UInt32 > const *self){
      return !(self->empty());
    }
SWIGINTERN bool std_vector_Sl_NTA_UInt32_Sg____bool__(std::vector< NTA_UInt32 > const *self){
      return !(self->empty());
    }
SWIGINTERN std::vector< unsigned int >::size_type std_vector_Sl_NTA_UInt32_Sg____len__(std::vector< NTA_UInt32 > const *self){
      return self->size();
    }
SWIGINTERN std::vector< unsigned int >::value_type std_vector_Sl_NTA_UInt32_Sg__pop(std::vector< NTA_UInt32 > *self){
      if (self->size() == 0)
	throw std::out_of_range("pop from empty container");
      std::vector<unsigned int,std::allocator< unsigned int > >::value_type x = self->back();
      self->pop_back();
      return x;
    }
SWIGINTERN std::vector< unsigned int,std::allocator< unsigned int > > *std_vector_Sl_NTA_UInt32_Sg____getslice__(std::vector< NTA_UInt32 > *self,std::vector< unsigned int >::difference_type i,std::vector< unsigned int >::difference_type j){
      return swig::getslice(self, i, j, 1);
    }
SWIGINTERN void std_vector_Sl_NTA_UInt32_Sg____setslice__(std::vector< NTA_UInt32 > *self,std::vector< unsigned int >::difference_type i,std::vector< unsigned int >::difference_type j,std::vector< unsigned int,std::allocator< unsigned int > > const &v=std::vector< unsigned int,std::allocator< unsigned int > >()){
      swig::setslice(self, i, j, 1, v);
    }
SWIGINTERN void std_vector_Sl_NTA_UInt32_Sg____delslice__(std::vector< NTA_UInt32 > *self,std::vector< unsigned int >::difference_type i,std::vector< unsigned int >::difference_type j){
      swig::delslice(self, i, j, 1);
    }
SWIGINTERN void std_vector_Sl_NTA_UInt32_Sg____delitem____SWIG_0(std::vector< NTA_UInt32 > *self,std::vector< unsigned int >::difference_type i){
      self->erase(swig::getpos(self,i));
    }
SWIGINTERN std::vector< unsigned int,std::allocator< unsigned int > > *std_vector_Sl_NTA_UInt32_Sg____getitem____SWIG_0(std::vector< NTA_UInt32 > *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<unsigned int,std::allocator< unsigned int > >::difference_type id = i;
      std::vector<unsigned int,std::allocator< unsigned int > >::difference_type jd = j;
      return swig::getslice(self, id, jd, step);
    }
SWIGINTERN void std_vector_Sl_NTA_UInt32_Sg____setitem____SWIG_0(std::vector< NTA_UInt32 > *self,PySliceObject *slice,std::vector< unsigned int,std::allocator< unsigned int > > 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<unsigned int,std::allocator< unsigned int > >::difference_type id = i;
      std::vector<unsigned int,std::allocator< unsigned int > >::difference_type jd = j;
      swig::setslice(self, id, jd, step, v);
    }
SWIGINTERN void std_vector_Sl_NTA_UInt32_Sg____setitem____SWIG_1(std::vector< NTA_UInt32 > *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<unsigned int,std::allocator< unsigned int > >::difference_type id = i;
      std::vector<unsigned int,std::allocator< unsigned int > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN void std_vector_Sl_NTA_UInt32_Sg____delitem____SWIG_1(std::vector< NTA_UInt32 > *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<unsigned int,std::allocator< unsigned int > >::difference_type id = i;
      std::vector<unsigned int,std::allocator< unsigned int > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN std::vector< unsigned int >::value_type const &std_vector_Sl_NTA_UInt32_Sg____getitem____SWIG_1(std::vector< NTA_UInt32 > const *self,std::vector< unsigned int >::difference_type i){
      return *(swig::cgetpos(self, i));
    }
SWIGINTERN void std_vector_Sl_NTA_UInt32_Sg____setitem____SWIG_2(std::vector< NTA_UInt32 > *self,std::vector< unsigned int >::difference_type i,std::vector< unsigned int >::value_type const &x){
      *(swig::getpos(self,i)) = x;
    }
SWIGINTERN void std_vector_Sl_NTA_UInt32_Sg__append(std::vector< NTA_UInt32 > *self,std::vector< unsigned int >::value_type const &x){
      self->push_back(x);
    }
SWIGINTERN std::vector< unsigned int >::iterator std_vector_Sl_NTA_UInt32_Sg__erase__SWIG_0(std::vector< NTA_UInt32 > *self,std::vector< unsigned int >::iterator pos){ return self->erase(pos); }
SWIGINTERN std::vector< unsigned int >::iterator std_vector_Sl_NTA_UInt32_Sg__erase__SWIG_1(std::vector< NTA_UInt32 > *self,std::vector< unsigned int >::iterator first,std::vector< unsigned int >::iterator last){ return self->erase(first, last); }
SWIGINTERN std::vector< unsigned int >::iterator std_vector_Sl_NTA_UInt32_Sg__insert__SWIG_0(std::vector< NTA_UInt32 > *self,std::vector< unsigned int >::iterator pos,std::vector< unsigned int >::value_type const &x){ return self->insert(pos, x); }
SWIGINTERN void std_vector_Sl_NTA_UInt32_Sg__insert__SWIG_1(std::vector< NTA_UInt32 > *self,std::vector< unsigned int >::iterator pos,std::vector< unsigned int >::size_type n,std::vector< unsigned int >::value_type const &x){ self->insert(pos, n, x); }

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


      namespace swig {
	template <>  struct traits<std::vector<unsigned long, std::allocator< unsigned long > > > {
	  typedef pointer_category category;
	  static const char* type_name() {
	    return "std::vector<" "unsigned long" "," "std::allocator< unsigned long >" " >";
	  }
	};
      }
    
SWIGINTERN swig::SwigPyIterator *std_vector_Sl_NTA_UInt64_Sg__iterator(std::vector< NTA_UInt64 > *self,PyObject **PYTHON_SELF){
      return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
    }
SWIGINTERN bool std_vector_Sl_NTA_UInt64_Sg____nonzero__(std::vector< NTA_UInt64 > const *self){
      return !(self->empty());
    }
SWIGINTERN bool std_vector_Sl_NTA_UInt64_Sg____bool__(std::vector< NTA_UInt64 > const *self){
      return !(self->empty());
    }
SWIGINTERN std::vector< unsigned long >::size_type std_vector_Sl_NTA_UInt64_Sg____len__(std::vector< NTA_UInt64 > const *self){
      return self->size();
    }
SWIGINTERN std::vector< unsigned long >::value_type std_vector_Sl_NTA_UInt64_Sg__pop(std::vector< NTA_UInt64 > *self){
      if (self->size() == 0)
	throw std::out_of_range("pop from empty container");
      std::vector<unsigned long,std::allocator< unsigned long > >::value_type x = self->back();
      self->pop_back();
      return x;
    }
SWIGINTERN std::vector< unsigned long,std::allocator< unsigned long > > *std_vector_Sl_NTA_UInt64_Sg____getslice__(std::vector< NTA_UInt64 > *self,std::vector< unsigned long >::difference_type i,std::vector< unsigned long >::difference_type j){
      return swig::getslice(self, i, j, 1);
    }
SWIGINTERN void std_vector_Sl_NTA_UInt64_Sg____setslice__(std::vector< NTA_UInt64 > *self,std::vector< unsigned long >::difference_type i,std::vector< unsigned long >::difference_type j,std::vector< unsigned long,std::allocator< unsigned long > > const &v=std::vector< unsigned long,std::allocator< unsigned long > >()){
      swig::setslice(self, i, j, 1, v);
    }
SWIGINTERN void std_vector_Sl_NTA_UInt64_Sg____delslice__(std::vector< NTA_UInt64 > *self,std::vector< unsigned long >::difference_type i,std::vector< unsigned long >::difference_type j){
      swig::delslice(self, i, j, 1);
    }
SWIGINTERN void std_vector_Sl_NTA_UInt64_Sg____delitem____SWIG_0(std::vector< NTA_UInt64 > *self,std::vector< unsigned long >::difference_type i){
      self->erase(swig::getpos(self,i));
    }
SWIGINTERN std::vector< unsigned long,std::allocator< unsigned long > > *std_vector_Sl_NTA_UInt64_Sg____getitem____SWIG_0(std::vector< NTA_UInt64 > *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<unsigned long,std::allocator< unsigned long > >::difference_type id = i;
      std::vector<unsigned long,std::allocator< unsigned long > >::difference_type jd = j;
      return swig::getslice(self, id, jd, step);
    }
SWIGINTERN void std_vector_Sl_NTA_UInt64_Sg____setitem____SWIG_0(std::vector< NTA_UInt64 > *self,PySliceObject *slice,std::vector< unsigned long,std::allocator< unsigned long > > 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<unsigned long,std::allocator< unsigned long > >::difference_type id = i;
      std::vector<unsigned long,std::allocator< unsigned long > >::difference_type jd = j;
      swig::setslice(self, id, jd, step, v);
    }
SWIGINTERN void std_vector_Sl_NTA_UInt64_Sg____setitem____SWIG_1(std::vector< NTA_UInt64 > *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<unsigned long,std::allocator< unsigned long > >::difference_type id = i;
      std::vector<unsigned long,std::allocator< unsigned long > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN void std_vector_Sl_NTA_UInt64_Sg____delitem____SWIG_1(std::vector< NTA_UInt64 > *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<unsigned long,std::allocator< unsigned long > >::difference_type id = i;
      std::vector<unsigned long,std::allocator< unsigned long > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN std::vector< unsigned long >::value_type const &std_vector_Sl_NTA_UInt64_Sg____getitem____SWIG_1(std::vector< NTA_UInt64 > const *self,std::vector< unsigned long >::difference_type i){
      return *(swig::cgetpos(self, i));
    }
SWIGINTERN void std_vector_Sl_NTA_UInt64_Sg____setitem____SWIG_2(std::vector< NTA_UInt64 > *self,std::vector< unsigned long >::difference_type i,std::vector< unsigned long >::value_type const &x){
      *(swig::getpos(self,i)) = x;
    }
SWIGINTERN void std_vector_Sl_NTA_UInt64_Sg__append(std::vector< NTA_UInt64 > *self,std::vector< unsigned long >::value_type const &x){
      self->push_back(x);
    }
SWIGINTERN std::vector< unsigned long >::iterator std_vector_Sl_NTA_UInt64_Sg__erase__SWIG_0(std::vector< NTA_UInt64 > *self,std::vector< unsigned long >::iterator pos){ return self->erase(pos); }
SWIGINTERN std::vector< unsigned long >::iterator std_vector_Sl_NTA_UInt64_Sg__erase__SWIG_1(std::vector< NTA_UInt64 > *self,std::vector< unsigned long >::iterator first,std::vector< unsigned long >::iterator last){ return self->erase(first, last); }
SWIGINTERN std::vector< unsigned long >::iterator std_vector_Sl_NTA_UInt64_Sg__insert__SWIG_0(std::vector< NTA_UInt64 > *self,std::vector< unsigned long >::iterator pos,std::vector< unsigned long >::value_type const &x){ return self->insert(pos, x); }
SWIGINTERN void std_vector_Sl_NTA_UInt64_Sg__insert__SWIG_1(std::vector< NTA_UInt64 > *self,std::vector< unsigned long >::iterator pos,std::vector< unsigned long >::size_type n,std::vector< unsigned long >::value_type const &x){ self->insert(pos, n, x); }

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


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 <>  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 swig::SwigPyIterator *std_vector_Sl_NTA_Real32_Sg__iterator(std::vector< NTA_Real32 > *self,PyObject **PYTHON_SELF){
      return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
    }
SWIGINTERN bool std_vector_Sl_NTA_Real32_Sg____nonzero__(std::vector< NTA_Real32 > const *self){
      return !(self->empty());
    }
SWIGINTERN bool std_vector_Sl_NTA_Real32_Sg____bool__(std::vector< NTA_Real32 > const *self){
      return !(self->empty());
    }
SWIGINTERN std::vector< float >::size_type std_vector_Sl_NTA_Real32_Sg____len__(std::vector< NTA_Real32 > const *self){
      return self->size();
    }
SWIGINTERN std::vector< float >::value_type std_vector_Sl_NTA_Real32_Sg__pop(std::vector< NTA_Real32 > *self){
      if (self->size() == 0)
	throw std::out_of_range("pop from empty container");
      std::vector<float,std::allocator< float > >::value_type x = self->back();
      self->pop_back();
      return x;
    }
SWIGINTERN std::vector< float,std::allocator< float > > *std_vector_Sl_NTA_Real32_Sg____getslice__(std::vector< NTA_Real32 > *self,std::vector< float >::difference_type i,std::vector< float >::difference_type j){
      return swig::getslice(self, i, j, 1);
    }
SWIGINTERN void std_vector_Sl_NTA_Real32_Sg____setslice__(std::vector< NTA_Real32 > *self,std::vector< float >::difference_type i,std::vector< float >::difference_type j,std::vector< float,std::allocator< float > > const &v=std::vector< float,std::allocator< float > >()){
      swig::setslice(self, i, j, 1, v);
    }
SWIGINTERN void std_vector_Sl_NTA_Real32_Sg____delslice__(std::vector< NTA_Real32 > *self,std::vector< float >::difference_type i,std::vector< float >::difference_type j){
      swig::delslice(self, i, j, 1);
    }
SWIGINTERN void std_vector_Sl_NTA_Real32_Sg____delitem____SWIG_0(std::vector< NTA_Real32 > *self,std::vector< float >::difference_type i){
      self->erase(swig::getpos(self,i));
    }
SWIGINTERN std::vector< float,std::allocator< float > > *std_vector_Sl_NTA_Real32_Sg____getitem____SWIG_0(std::vector< NTA_Real32 > *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<float,std::allocator< float > >::difference_type id = i;
      std::vector<float,std::allocator< float > >::difference_type jd = j;
      return swig::getslice(self, id, jd, step);
    }
SWIGINTERN void std_vector_Sl_NTA_Real32_Sg____setitem____SWIG_0(std::vector< NTA_Real32 > *self,PySliceObject *slice,std::vector< float,std::allocator< float > > 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<float,std::allocator< float > >::difference_type id = i;
      std::vector<float,std::allocator< float > >::difference_type jd = j;
      swig::setslice(self, id, jd, step, v);
    }
SWIGINTERN void std_vector_Sl_NTA_Real32_Sg____setitem____SWIG_1(std::vector< NTA_Real32 > *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<float,std::allocator< float > >::difference_type id = i;
      std::vector<float,std::allocator< float > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN void std_vector_Sl_NTA_Real32_Sg____delitem____SWIG_1(std::vector< NTA_Real32 > *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<float,std::allocator< float > >::difference_type id = i;
      std::vector<float,std::allocator< float > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN std::vector< float >::value_type const &std_vector_Sl_NTA_Real32_Sg____getitem____SWIG_1(std::vector< NTA_Real32 > const *self,std::vector< float >::difference_type i){
      return *(swig::cgetpos(self, i));
    }
SWIGINTERN void std_vector_Sl_NTA_Real32_Sg____setitem____SWIG_2(std::vector< NTA_Real32 > *self,std::vector< float >::difference_type i,std::vector< float >::value_type const &x){
      *(swig::getpos(self,i)) = x;
    }
SWIGINTERN void std_vector_Sl_NTA_Real32_Sg__append(std::vector< NTA_Real32 > *self,std::vector< float >::value_type const &x){
      self->push_back(x);
    }
SWIGINTERN std::vector< float >::iterator std_vector_Sl_NTA_Real32_Sg__erase__SWIG_0(std::vector< NTA_Real32 > *self,std::vector< float >::iterator pos){ return self->erase(pos); }
SWIGINTERN std::vector< float >::iterator std_vector_Sl_NTA_Real32_Sg__erase__SWIG_1(std::vector< NTA_Real32 > *self,std::vector< float >::iterator first,std::vector< float >::iterator last){ return self->erase(first, last); }
SWIGINTERN std::vector< float >::iterator std_vector_Sl_NTA_Real32_Sg__insert__SWIG_0(std::vector< NTA_Real32 > *self,std::vector< float >::iterator pos,std::vector< float >::value_type const &x){ return self->insert(pos, x); }
SWIGINTERN void std_vector_Sl_NTA_Real32_Sg__insert__SWIG_1(std::vector< NTA_Real32 > *self,std::vector< float >::iterator pos,std::vector< float >::size_type n,std::vector< float >::value_type const &x){ self->insert(pos, n, x); }

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


      namespace swig {
	template <>  struct traits<std::vector<double, std::allocator< double > > > {
	  typedef pointer_category category;
	  static const char* type_name() {
	    return "std::vector<" "double" "," "std::allocator< double >" " >";
	  }
	};
      }
    
SWIGINTERN swig::SwigPyIterator *std_vector_Sl_NTA_Real64_Sg__iterator(std::vector< NTA_Real64 > *self,PyObject **PYTHON_SELF){
      return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
    }
SWIGINTERN bool std_vector_Sl_NTA_Real64_Sg____nonzero__(std::vector< NTA_Real64 > const *self){
      return !(self->empty());
    }
SWIGINTERN bool std_vector_Sl_NTA_Real64_Sg____bool__(std::vector< NTA_Real64 > const *self){
      return !(self->empty());
    }
SWIGINTERN std::vector< double >::size_type std_vector_Sl_NTA_Real64_Sg____len__(std::vector< NTA_Real64 > const *self){
      return self->size();
    }
SWIGINTERN std::vector< double >::value_type std_vector_Sl_NTA_Real64_Sg__pop(std::vector< NTA_Real64 > *self){
      if (self->size() == 0)
	throw std::out_of_range("pop from empty container");
      std::vector<double,std::allocator< double > >::value_type x = self->back();
      self->pop_back();
      return x;
    }
SWIGINTERN std::vector< double,std::allocator< double > > *std_vector_Sl_NTA_Real64_Sg____getslice__(std::vector< NTA_Real64 > *self,std::vector< double >::difference_type i,std::vector< double >::difference_type j){
      return swig::getslice(self, i, j, 1);
    }
SWIGINTERN void std_vector_Sl_NTA_Real64_Sg____setslice__(std::vector< NTA_Real64 > *self,std::vector< double >::difference_type i,std::vector< double >::difference_type j,std::vector< double,std::allocator< double > > const &v=std::vector< double,std::allocator< double > >()){
      swig::setslice(self, i, j, 1, v);
    }
SWIGINTERN void std_vector_Sl_NTA_Real64_Sg____delslice__(std::vector< NTA_Real64 > *self,std::vector< double >::difference_type i,std::vector< double >::difference_type j){
      swig::delslice(self, i, j, 1);
    }
SWIGINTERN void std_vector_Sl_NTA_Real64_Sg____delitem____SWIG_0(std::vector< NTA_Real64 > *self,std::vector< double >::difference_type i){
      self->erase(swig::getpos(self,i));
    }
SWIGINTERN std::vector< double,std::allocator< double > > *std_vector_Sl_NTA_Real64_Sg____getitem____SWIG_0(std::vector< NTA_Real64 > *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<double,std::allocator< double > >::difference_type id = i;
      std::vector<double,std::allocator< double > >::difference_type jd = j;
      return swig::getslice(self, id, jd, step);
    }
SWIGINTERN void std_vector_Sl_NTA_Real64_Sg____setitem____SWIG_0(std::vector< NTA_Real64 > *self,PySliceObject *slice,std::vector< double,std::allocator< double > > 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<double,std::allocator< double > >::difference_type id = i;
      std::vector<double,std::allocator< double > >::difference_type jd = j;
      swig::setslice(self, id, jd, step, v);
    }
SWIGINTERN void std_vector_Sl_NTA_Real64_Sg____setitem____SWIG_1(std::vector< NTA_Real64 > *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<double,std::allocator< double > >::difference_type id = i;
      std::vector<double,std::allocator< double > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN void std_vector_Sl_NTA_Real64_Sg____delitem____SWIG_1(std::vector< NTA_Real64 > *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<double,std::allocator< double > >::difference_type id = i;
      std::vector<double,std::allocator< double > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN std::vector< double >::value_type const &std_vector_Sl_NTA_Real64_Sg____getitem____SWIG_1(std::vector< NTA_Real64 > const *self,std::vector< double >::difference_type i){
      return *(swig::cgetpos(self, i));
    }
SWIGINTERN void std_vector_Sl_NTA_Real64_Sg____setitem____SWIG_2(std::vector< NTA_Real64 > *self,std::vector< double >::difference_type i,std::vector< double >::value_type const &x){
      *(swig::getpos(self,i)) = x;
    }
SWIGINTERN void std_vector_Sl_NTA_Real64_Sg__append(std::vector< NTA_Real64 > *self,std::vector< double >::value_type const &x){
      self->push_back(x);
    }
SWIGINTERN std::vector< double >::iterator std_vector_Sl_NTA_Real64_Sg__erase__SWIG_0(std::vector< NTA_Real64 > *self,std::vector< double >::iterator pos){ return self->erase(pos); }
SWIGINTERN std::vector< double >::iterator std_vector_Sl_NTA_Real64_Sg__erase__SWIG_1(std::vector< NTA_Real64 > *self,std::vector< double >::iterator first,std::vector< double >::iterator last){ return self->erase(first, last); }
SWIGINTERN std::vector< double >::iterator std_vector_Sl_NTA_Real64_Sg__insert__SWIG_0(std::vector< NTA_Real64 > *self,std::vector< double >::iterator pos,std::vector< double >::value_type const &x){ return self->insert(pos, x); }
SWIGINTERN void std_vector_Sl_NTA_Real64_Sg__insert__SWIG_1(std::vector< NTA_Real64 > *self,std::vector< double >::iterator pos,std::vector< double >::size_type n,std::vector< double >::value_type const &x){ self->insert(pos, n, x); }

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 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 int
SWIG_AsVal_std_string (PyObject * obj, std::string *val)
{
  std::string* v = (std::string *) 0;
  int res = SWIG_AsPtr_std_string (obj, &v);
  if (!SWIG_IsOK(res)) return res;
  if (v) {
    if (val) *val = *v;
    if (SWIG_IsNewObj(res)) {
      delete v;
      res = SWIG_DelNewMask(res);
    }
    return res;
  }
  return SWIG_ERROR;
}


SWIGINTERNINLINE PyObject *
SWIG_From_std_string  (const std::string& s)
{
  return SWIG_FromCharPtrAndSize(s.data(), s.size());
}


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


      namespace swig {
	template <>  struct traits<std::vector<std::string, std::allocator< std::string > > > {
	  typedef pointer_category category;
	  static const char* type_name() {
	    return "std::vector<" "std::string" "," "std::allocator< std::string >" " >";
	  }
	};
      }
    
SWIGINTERN swig::SwigPyIterator *std_vector_Sl_std_string_Sg__iterator(std::vector< std::string > *self,PyObject **PYTHON_SELF){
      return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
    }
SWIGINTERN bool std_vector_Sl_std_string_Sg____nonzero__(std::vector< std::string > const *self){
      return !(self->empty());
    }
SWIGINTERN bool std_vector_Sl_std_string_Sg____bool__(std::vector< std::string > const *self){
      return !(self->empty());
    }
SWIGINTERN std::vector< std::string >::size_type std_vector_Sl_std_string_Sg____len__(std::vector< std::string > const *self){
      return self->size();
    }
SWIGINTERN std::vector< std::string >::value_type std_vector_Sl_std_string_Sg__pop(std::vector< std::string > *self){
      if (self->size() == 0)
	throw std::out_of_range("pop from empty container");
      std::vector<std::string,std::allocator< std::string > >::value_type x = self->back();
      self->pop_back();
      return x;
    }
SWIGINTERN std::vector< std::string,std::allocator< std::string > > *std_vector_Sl_std_string_Sg____getslice__(std::vector< std::string > *self,std::vector< std::string >::difference_type i,std::vector< std::string >::difference_type j){
      return swig::getslice(self, i, j, 1);
    }
SWIGINTERN void std_vector_Sl_std_string_Sg____setslice__(std::vector< std::string > *self,std::vector< std::string >::difference_type i,std::vector< std::string >::difference_type j,std::vector< std::string,std::allocator< std::string > > const &v=std::vector< std::string,std::allocator< std::string > >()){
      swig::setslice(self, i, j, 1, v);
    }
SWIGINTERN void std_vector_Sl_std_string_Sg____delslice__(std::vector< std::string > *self,std::vector< std::string >::difference_type i,std::vector< std::string >::difference_type j){
      swig::delslice(self, i, j, 1);
    }
SWIGINTERN void std_vector_Sl_std_string_Sg____delitem____SWIG_0(std::vector< std::string > *self,std::vector< std::string >::difference_type i){
      self->erase(swig::getpos(self,i));
    }
SWIGINTERN std::vector< std::string,std::allocator< std::string > > *std_vector_Sl_std_string_Sg____getitem____SWIG_0(std::vector< std::string > *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<std::string,std::allocator< std::string > >::difference_type id = i;
      std::vector<std::string,std::allocator< std::string > >::difference_type jd = j;
      return swig::getslice(self, id, jd, step);
    }
SWIGINTERN void std_vector_Sl_std_string_Sg____setitem____SWIG_0(std::vector< std::string > *self,PySliceObject *slice,std::vector< std::string,std::allocator< std::string > > 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<std::string,std::allocator< std::string > >::difference_type id = i;
      std::vector<std::string,std::allocator< std::string > >::difference_type jd = j;
      swig::setslice(self, id, jd, step, v);
    }
SWIGINTERN void std_vector_Sl_std_string_Sg____setitem____SWIG_1(std::vector< std::string > *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<std::string,std::allocator< std::string > >::difference_type id = i;
      std::vector<std::string,std::allocator< std::string > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN void std_vector_Sl_std_string_Sg____delitem____SWIG_1(std::vector< std::string > *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<std::string,std::allocator< std::string > >::difference_type id = i;
      std::vector<std::string,std::allocator< std::string > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN std::vector< std::string >::value_type const &std_vector_Sl_std_string_Sg____getitem____SWIG_1(std::vector< std::string > const *self,std::vector< std::string >::difference_type i){
      return *(swig::cgetpos(self, i));
    }
SWIGINTERN void std_vector_Sl_std_string_Sg____setitem____SWIG_2(std::vector< std::string > *self,std::vector< std::string >::difference_type i,std::vector< std::string >::value_type const &x){
      *(swig::getpos(self,i)) = x;
    }
SWIGINTERN void std_vector_Sl_std_string_Sg__append(std::vector< std::string > *self,std::vector< std::string >::value_type const &x){
      self->push_back(x);
    }
SWIGINTERN std::vector< std::string >::iterator std_vector_Sl_std_string_Sg__erase__SWIG_0(std::vector< std::string > *self,std::vector< std::string >::iterator pos){ return self->erase(pos); }
SWIGINTERN std::vector< std::string >::iterator std_vector_Sl_std_string_Sg__erase__SWIG_1(std::vector< std::string > *self,std::vector< std::string >::iterator first,std::vector< std::string >::iterator last){ return self->erase(first, last); }
SWIGINTERN std::vector< std::string >::iterator std_vector_Sl_std_string_Sg__insert__SWIG_0(std::vector< std::string > *self,std::vector< std::string >::iterator pos,std::vector< std::string >::value_type const &x){ return self->insert(pos, x); }
SWIGINTERN void std_vector_Sl_std_string_Sg__insert__SWIG_1(std::vector< std::string > *self,std::vector< std::string >::iterator pos,std::vector< std::string >::size_type n,std::vector< std::string >::value_type const &x){ self->insert(pos, n, x); }

  namespace swig {
    template <class T >
    struct traits_asptr<std::list<T> >  {
      static int asptr(PyObject *obj, std::list<T> **lis) {
	return traits_asptr_stdseq<std::list<T> >::asptr(obj, lis);
      }
    };

    template <class T>
    struct traits_from<std::list<T> > {
      static PyObject *from(const std::list<T> & vec) {
	return traits_from_stdseq<std::list<T> >::from(vec);
      }
    };
  }


      namespace swig {
	template <>  struct traits<std::list<std::string, std::allocator< std::string > > > {
	  typedef pointer_category category;
	  static const char* type_name() {
	    return "std::list<" "std::string" ", " "std::allocator< std::string >" " >";
	  }
	};
      }
    
SWIGINTERN swig::SwigPyIterator *std_list_Sl_std_string_Sg__iterator(std::list< std::string > *self,PyObject **PYTHON_SELF){
      return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
    }
SWIGINTERN bool std_list_Sl_std_string_Sg____nonzero__(std::list< std::string > const *self){
      return !(self->empty());
    }
SWIGINTERN bool std_list_Sl_std_string_Sg____bool__(std::list< std::string > const *self){
      return !(self->empty());
    }
SWIGINTERN std::list< std::string >::size_type std_list_Sl_std_string_Sg____len__(std::list< std::string > const *self){
      return self->size();
    }
SWIGINTERN std::list< std::string >::value_type std_list_Sl_std_string_Sg__pop(std::list< std::string > *self){
      if (self->size() == 0)
	throw std::out_of_range("pop from empty container");
      std::list<std::string,std::allocator< std::string > >::value_type x = self->back();
      self->pop_back();
      return x;
    }
SWIGINTERN std::list< std::string,std::allocator< std::string > > *std_list_Sl_std_string_Sg____getslice__(std::list< std::string > *self,std::list< std::string >::difference_type i,std::list< std::string >::difference_type j){
      return swig::getslice(self, i, j, 1);
    }
SWIGINTERN void std_list_Sl_std_string_Sg____setslice__(std::list< std::string > *self,std::list< std::string >::difference_type i,std::list< std::string >::difference_type j,std::list< std::string,std::allocator< std::string > > const &v=std::list< std::string,std::allocator< std::string > >()){
      swig::setslice(self, i, j, 1, v);
    }
SWIGINTERN void std_list_Sl_std_string_Sg____delslice__(std::list< std::string > *self,std::list< std::string >::difference_type i,std::list< std::string >::difference_type j){
      swig::delslice(self, i, j, 1);
    }
SWIGINTERN void std_list_Sl_std_string_Sg____delitem____SWIG_0(std::list< std::string > *self,std::list< std::string >::difference_type i){
      self->erase(swig::getpos(self,i));
    }
SWIGINTERN std::list< std::string,std::allocator< std::string > > *std_list_Sl_std_string_Sg____getitem____SWIG_0(std::list< std::string > *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::list<std::string,std::allocator< std::string > >::difference_type id = i;
      std::list<std::string,std::allocator< std::string > >::difference_type jd = j;
      return swig::getslice(self, id, jd, step);
    }
SWIGINTERN void std_list_Sl_std_string_Sg____setitem____SWIG_0(std::list< std::string > *self,PySliceObject *slice,std::list< std::string,std::allocator< std::string > > 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::list<std::string,std::allocator< std::string > >::difference_type id = i;
      std::list<std::string,std::allocator< std::string > >::difference_type jd = j;
      swig::setslice(self, id, jd, step, v);
    }
SWIGINTERN void std_list_Sl_std_string_Sg____setitem____SWIG_1(std::list< std::string > *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::list<std::string,std::allocator< std::string > >::difference_type id = i;
      std::list<std::string,std::allocator< std::string > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN void std_list_Sl_std_string_Sg____delitem____SWIG_1(std::list< std::string > *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::list<std::string,std::allocator< std::string > >::difference_type id = i;
      std::list<std::string,std::allocator< std::string > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN std::list< std::string >::value_type const &std_list_Sl_std_string_Sg____getitem____SWIG_1(std::list< std::string > const *self,std::list< std::string >::difference_type i){
      return *(swig::cgetpos(self, i));
    }
SWIGINTERN void std_list_Sl_std_string_Sg____setitem____SWIG_2(std::list< std::string > *self,std::list< std::string >::difference_type i,std::list< std::string >::value_type const &x){
      *(swig::getpos(self,i)) = x;
    }
SWIGINTERN void std_list_Sl_std_string_Sg__append(std::list< std::string > *self,std::list< std::string >::value_type const &x){
      self->push_back(x);
    }
SWIGINTERN std::list< std::string >::iterator std_list_Sl_std_string_Sg__erase__SWIG_0(std::list< std::string > *self,std::list< std::string >::iterator pos){ return self->erase(pos); }
SWIGINTERN std::list< std::string >::iterator std_list_Sl_std_string_Sg__erase__SWIG_1(std::list< std::string > *self,std::list< std::string >::iterator first,std::list< std::string >::iterator last){ return self->erase(first, last); }
SWIGINTERN std::list< std::string >::iterator std_list_Sl_std_string_Sg__insert__SWIG_0(std::list< std::string > *self,std::list< std::string >::iterator pos,std::list< std::string >::value_type const &x){ return self->insert(pos, x); }
SWIGINTERN void std_list_Sl_std_string_Sg__insert__SWIG_1(std::list< std::string > *self,std::list< std::string >::iterator pos,std::list< std::string >::size_type n,std::list< std::string >::value_type const &x){ self->insert(pos, n, x); }

  namespace swig {
    template <class SwigPySeq, class T> 
    inline void 
    assign(const SwigPySeq& swigpyseq, std::set<T>* seq) {
      // seq->insert(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 T>
    struct traits_asptr<std::set<T> >  {
      static int asptr(PyObject *obj, std::set<T> **s) {
	return traits_asptr_stdseq<std::set<T> >::asptr(obj, s);
      }
    };

    template <class T>
    struct traits_from<std::set<T> > {
      static PyObject *from(const std::set<T>& vec) {
	return traits_from_stdseq<std::set<T> >::from(vec);
      }
    };
  }


      namespace swig {
	template <>  struct traits<std::set<std::string, std::less< std::string >, std::allocator< std::string > > > {
	  typedef pointer_category category;
	  static const char* type_name() {
	    return "std::set<" "std::string" "," "std::less< std::string >" "," "std::allocator< std::string >" " >";
	  }
	};
      }
    
SWIGINTERN swig::SwigPyIterator *std_set_Sl_std_string_Sg__iterator(std::set< std::string > *self,PyObject **PYTHON_SELF){
      return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
    }
SWIGINTERN bool std_set_Sl_std_string_Sg____nonzero__(std::set< std::string > const *self){
      return !(self->empty());
    }
SWIGINTERN bool std_set_Sl_std_string_Sg____bool__(std::set< std::string > const *self){
      return !(self->empty());
    }
SWIGINTERN std::set< std::string >::size_type std_set_Sl_std_string_Sg____len__(std::set< std::string > const *self){
      return self->size();
    }
SWIGINTERN void std_set_Sl_std_string_Sg__append(std::set< std::string > *self,std::set< std::string >::value_type x){
       self->insert(x);
     }
SWIGINTERN bool std_set_Sl_std_string_Sg____contains__(std::set< std::string > *self,std::set< std::string >::value_type x){
       return self->find(x) != self->end();
     }
SWIGINTERN std::set< std::string >::value_type std_set_Sl_std_string_Sg____getitem__(std::set< std::string > const *self,std::set< std::string >::difference_type i){
       return *(swig::cgetpos(self, i));
     }
SWIGINTERN void std_set_Sl_std_string_Sg__add(std::set< std::string > *self,std::set< std::string >::value_type x){
       self->insert(x);
     }
SWIGINTERN void std_set_Sl_std_string_Sg__discard(std::set< std::string > *self,std::set< std::string >::value_type x){
       self->erase(x);
     }
SWIGINTERN void std_set_Sl_std_string_Sg__erase__SWIG_1(std::set< std::string > *self,std::set< std::string >::iterator pos){ self->erase(pos); }
SWIGINTERN void std_set_Sl_std_string_Sg__erase__SWIG_2(std::set< std::string > *self,std::set< std::string >::iterator first,std::set< std::string >::iterator last){ self->erase(first, last); }


  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< std::string, std::string > > {
	  typedef pointer_category category;
	  static const char* type_name() {
	    return "std::pair<" "std::string" "," "std::string" " >";
	  }
	};
      }
    

  namespace swig {
    template <class ValueType>
    struct from_key_oper 
    {
      typedef const ValueType& argument_type;
      typedef  PyObject *result_type;
      result_type operator()(argument_type v) const
      {
	return swig::from(v.first);
      }
    };

    template <class ValueType>
    struct from_value_oper 
    {
      typedef const ValueType& argument_type;
      typedef  PyObject *result_type;
      result_type operator()(argument_type v) const
      {
	return swig::from(v.second);
      }
    };

    template<class OutIterator, class FromOper, class ValueType = typename OutIterator::value_type>
    struct SwigPyMapIterator_T : SwigPyIteratorClosed_T<OutIterator, ValueType, FromOper>
    {
      SwigPyMapIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
	: SwigPyIteratorClosed_T<OutIterator,ValueType,FromOper>(curr, first, last, seq)
      {
      }
    };


    template<class OutIterator,
	     class FromOper = from_key_oper<typename OutIterator::value_type> >
    struct SwigPyMapKeyIterator_T : SwigPyMapIterator_T<OutIterator, FromOper>
    {
      SwigPyMapKeyIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
	: SwigPyMapIterator_T<OutIterator, FromOper>(curr, first, last, seq)
      {
      }
    };

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

    template<class OutIterator,
	     class FromOper = from_value_oper<typename OutIterator::value_type> >
    struct SwigPyMapValueITerator_T : SwigPyMapIterator_T<OutIterator, FromOper>
    {
      SwigPyMapValueITerator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
	: SwigPyMapIterator_T<OutIterator, FromOper>(curr, first, last, seq)
      {
      }
    };
    

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


  namespace swig {
    template <class SwigPySeq, class K, class T, class Compare, class Alloc >
    inline void
    assign(const SwigPySeq& swigpyseq, std::map<K,T,Compare,Alloc > *map) {
      typedef typename std::map<K,T,Compare,Alloc >::value_type value_type;
      typename SwigPySeq::const_iterator it = swigpyseq.begin();
      for (;it != swigpyseq.end(); ++it) {
	map->insert(value_type(it->first, it->second));
      }
    }

    template <class K, class T, class Compare, class Alloc>
    struct traits_asptr<std::map<K,T,Compare,Alloc > >  {
      typedef std::map<K,T,Compare,Alloc > map_type;
      static int asptr(PyObject *obj, map_type **val) {
	int res = SWIG_ERROR;
	SWIG_PYTHON_THREAD_BEGIN_BLOCK;
	if (PyDict_Check(obj)) {
	  SwigVar_PyObject items = PyObject_CallMethod(obj,(char *)"items",NULL);
#if PY_VERSION_HEX >= 0x03000000
          /* In Python 3.x the ".items()" method returns a dict_items object */
          items = PySequence_Fast(items, ".items() didn't return a sequence!");
#endif
	  res = traits_asptr_stdseq<map_type, std::pair<K, T> >::asptr(items, val);
	} else {
	  map_type *p;
	  res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<map_type>(),0);
	  if (SWIG_IsOK(res) && val)  *val = p;
	}
	SWIG_PYTHON_THREAD_END_BLOCK;
	return res;
      }      
    };
      
    template <class K, class T, class Compare, class Alloc >
    struct traits_from<std::map<K,T,Compare,Alloc > >  {
      typedef std::map<K,T,Compare,Alloc > map_type;
      typedef typename map_type::const_iterator const_iterator;
      typedef typename map_type::size_type size_type;

      static PyObject *asdict(const map_type& map) {
	SWIG_PYTHON_THREAD_BEGIN_BLOCK;
	size_type size = map.size();
	int pysize = (size <= (size_type) INT_MAX) ? (int) size : -1;
	if (pysize < 0) {
	  PyErr_SetString(PyExc_OverflowError,
			  "map size not valid in python");
	  SWIG_PYTHON_THREAD_END_BLOCK;
	  return NULL;
	}
	PyObject *obj = PyDict_New();
	for (const_iterator i= map.begin(); i!= map.end(); ++i) {
	  swig::SwigVar_PyObject key = swig::from(i->first);
	  swig::SwigVar_PyObject val = swig::from(i->second);
	  PyDict_SetItem(obj, key, val);
	}
	SWIG_PYTHON_THREAD_END_BLOCK;
	return obj;
      }
                
      static PyObject *from(const map_type& map) {
	swig_type_info *desc = swig::type_info<map_type>();
	if (desc && desc->clientdata) {
	  return SWIG_InternalNewPointerObj(new map_type(map), desc, SWIG_POINTER_OWN);
	} else {
	  return asdict(map);
	}
      }
    };
  }


      namespace swig {
	template <>  struct traits<std::map<std::string, std::string, std::less< std::string >, std::allocator< std::pair< std::string const,std::string > > > > {
	  typedef pointer_category category;
	  static const char* type_name() {
	    return "std::map<" "std::string" "," "std::string" "," "std::less< std::string >" "," "std::allocator< std::pair< std::string const,std::string > >" " >";
	  }
	};
      }
    
SWIGINTERN swig::SwigPyIterator *std_map_Sl_std_string_Sc_std_string_Sg__iterator(std::map< std::string,std::string > *self,PyObject **PYTHON_SELF){
      return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
    }
SWIGINTERN bool std_map_Sl_std_string_Sc_std_string_Sg____nonzero__(std::map< std::string,std::string > const *self){
      return !(self->empty());
    }
SWIGINTERN bool std_map_Sl_std_string_Sc_std_string_Sg____bool__(std::map< std::string,std::string > const *self){
      return !(self->empty());
    }
SWIGINTERN std::map< std::string,std::string >::size_type std_map_Sl_std_string_Sc_std_string_Sg____len__(std::map< std::string,std::string > const *self){
      return self->size();
    }
SWIGINTERN std::map< std::string,std::string >::mapped_type const &std_map_Sl_std_string_Sc_std_string_Sg____getitem__(std::map< std::string,std::string > *self,std::map< std::string,std::string >::key_type const &key){
      std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >::const_iterator i = self->find(key);
      if (i != self->end())
	return i->second;
      else
	throw std::out_of_range("key not found");
    }
SWIGINTERN void std_map_Sl_std_string_Sc_std_string_Sg____delitem__(std::map< std::string,std::string > *self,std::map< std::string,std::string >::key_type const &key){
      std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >::iterator i = self->find(key);
      if (i != self->end())
	self->erase(i);
      else
	throw std::out_of_range("key not found");
    }
SWIGINTERN bool std_map_Sl_std_string_Sc_std_string_Sg__has_key(std::map< std::string,std::string > const *self,std::map< std::string,std::string >::key_type const &key){
      std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >::const_iterator i = self->find(key);
      return i != self->end();
    }
SWIGINTERN PyObject *std_map_Sl_std_string_Sc_std_string_Sg__keys(std::map< std::string,std::string > *self){
      std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >::size_type size = self->size();
      int pysize = (size <= (std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >::size_type) INT_MAX) ? (int) size : -1;
      SWIG_PYTHON_THREAD_BEGIN_BLOCK;
      if (pysize < 0) {
	PyErr_SetString(PyExc_OverflowError,
			"map size not valid in python");
	SWIG_PYTHON_THREAD_END_BLOCK;
	return NULL;
      }
      PyObject* keyList = PyList_New(pysize);
      std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >::const_iterator i = self->begin();
      for (int j = 0; j < pysize; ++i, ++j) {
	PyList_SET_ITEM(keyList, j, swig::from(i->first));
      }
      SWIG_PYTHON_THREAD_END_BLOCK;
      return keyList;
    }
SWIGINTERN PyObject *std_map_Sl_std_string_Sc_std_string_Sg__values(std::map< std::string,std::string > *self){
      std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >::size_type size = self->size();
      int pysize = (size <= (std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >::size_type) INT_MAX) ? (int) size : -1;
      SWIG_PYTHON_THREAD_BEGIN_BLOCK;
      if (pysize < 0) {
	PyErr_SetString(PyExc_OverflowError,
			"map size not valid in python");
	SWIG_PYTHON_THREAD_END_BLOCK;
	return NULL;
      }
      PyObject* valList = PyList_New(pysize);
      std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >::const_iterator i = self->begin();
      for (int j = 0; j < pysize; ++i, ++j) {
	PyList_SET_ITEM(valList, j, swig::from(i->second));
      }
      SWIG_PYTHON_THREAD_END_BLOCK;
      return valList;
    }
SWIGINTERN PyObject *std_map_Sl_std_string_Sc_std_string_Sg__items(std::map< std::string,std::string > *self){
      std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >::size_type size = self->size();
      int pysize = (size <= (std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >::size_type) INT_MAX) ? (int) size : -1;
      SWIG_PYTHON_THREAD_BEGIN_BLOCK;
      if (pysize < 0) {
	PyErr_SetString(PyExc_OverflowError,
			"map size not valid in python");
	SWIG_PYTHON_THREAD_END_BLOCK;
	return NULL;
      }    
      PyObject* itemList = PyList_New(pysize);
      std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >::const_iterator i = self->begin();
      for (int j = 0; j < pysize; ++i, ++j) {
	PyList_SET_ITEM(itemList, j, swig::from(*i));
      }
      SWIG_PYTHON_THREAD_END_BLOCK;
      return itemList;
    }
SWIGINTERN bool std_map_Sl_std_string_Sc_std_string_Sg____contains__(std::map< std::string,std::string > *self,std::map< std::string,std::string >::key_type const &key){
      return self->find(key) != self->end();
    }
SWIGINTERN swig::SwigPyIterator *std_map_Sl_std_string_Sc_std_string_Sg__key_iterator(std::map< std::string,std::string > *self,PyObject **PYTHON_SELF){
      return swig::make_output_key_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
    }
SWIGINTERN swig::SwigPyIterator *std_map_Sl_std_string_Sc_std_string_Sg__value_iterator(std::map< std::string,std::string > *self,PyObject **PYTHON_SELF){
      return swig::make_output_value_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
    }
SWIGINTERN void std_map_Sl_std_string_Sc_std_string_Sg____setitem____SWIG_0(std::map< std::string,std::string > *self,std::map< std::string,std::string >::key_type const &key){
      self->erase(key);
    }
SWIGINTERN void std_map_Sl_std_string_Sc_std_string_Sg____setitem____SWIG_1(std::map< std::string,std::string > *self,std::map< std::string,std::string >::key_type const &key,std::map< std::string,std::string >::mapped_type const &x){
      (*self)[key] = x;
    }
SWIGINTERN PyObject *std_map_Sl_std_string_Sc_std_string_Sg__asdict(std::map< std::string,std::string > *self){
      return swig::traits_from< std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > >::asdict(*self);
    }
SWIGINTERN void std_map_Sl_std_string_Sc_std_string_Sg__erase__SWIG_1(std::map< std::string,std::string > *self,std::map< std::string,std::string >::iterator position){ self->erase(position); }
SWIGINTERN void std_map_Sl_std_string_Sc_std_string_Sg__erase__SWIG_2(std::map< std::string,std::string > *self,std::map< std::string,std::string >::iterator first,std::map< std::string,std::string >::iterator last){ self->erase(first, last); }

      namespace swig {
	template <>  struct traits<std::vector<std::pair< std::string,std::string >, std::allocator< std::pair< std::string,std::string > > > > {
	  typedef pointer_category category;
	  static const char* type_name() {
	    return "std::vector<" "std::pair< std::string,std::string >" "," "std::allocator< std::pair< std::string,std::string > >" " >";
	  }
	};
      }
    
SWIGINTERN swig::SwigPyIterator *std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__Sg__iterator(std::vector< std::pair< std::string,std::string > > *self,PyObject **PYTHON_SELF){
      return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
    }
SWIGINTERN bool std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__Sg____nonzero__(std::vector< std::pair< std::string,std::string > > const *self){
      return !(self->empty());
    }
SWIGINTERN bool std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__Sg____bool__(std::vector< std::pair< std::string,std::string > > const *self){
      return !(self->empty());
    }
SWIGINTERN std::vector< std::pair< std::string,std::string > >::size_type std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__Sg____len__(std::vector< std::pair< std::string,std::string > > const *self){
      return self->size();
    }
SWIGINTERN std::vector< std::pair< std::string,std::string > >::value_type std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__Sg__pop(std::vector< std::pair< std::string,std::string > > *self){
      if (self->size() == 0)
	throw std::out_of_range("pop from empty container");
      std::vector<std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > >::value_type x = self->back();
      self->pop_back();
      return x;
    }
SWIGINTERN std::vector< std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > > *std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__Sg____getslice__(std::vector< std::pair< std::string,std::string > > *self,std::vector< std::pair< std::string,std::string > >::difference_type i,std::vector< std::pair< std::string,std::string > >::difference_type j){
      return swig::getslice(self, i, j, 1);
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__Sg____setslice__(std::vector< std::pair< std::string,std::string > > *self,std::vector< std::pair< std::string,std::string > >::difference_type i,std::vector< std::pair< std::string,std::string > >::difference_type j,std::vector< std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > > const &v=std::vector< std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > >()){
      swig::setslice(self, i, j, 1, v);
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__Sg____delslice__(std::vector< std::pair< std::string,std::string > > *self,std::vector< std::pair< std::string,std::string > >::difference_type i,std::vector< std::pair< std::string,std::string > >::difference_type j){
      swig::delslice(self, i, j, 1);
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__Sg____delitem____SWIG_0(std::vector< std::pair< std::string,std::string > > *self,std::vector< std::pair< std::string,std::string > >::difference_type i){
      self->erase(swig::getpos(self,i));
    }
SWIGINTERN std::vector< std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > > *std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__Sg____getitem____SWIG_0(std::vector< std::pair< std::string,std::string > > *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<std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > >::difference_type id = i;
      std::vector<std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > >::difference_type jd = j;
      return swig::getslice(self, id, jd, step);
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__Sg____setitem____SWIG_0(std::vector< std::pair< std::string,std::string > > *self,PySliceObject *slice,std::vector< std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > > 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<std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > >::difference_type id = i;
      std::vector<std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > >::difference_type jd = j;
      swig::setslice(self, id, jd, step, v);
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__Sg____setitem____SWIG_1(std::vector< std::pair< std::string,std::string > > *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<std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > >::difference_type id = i;
      std::vector<std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__Sg____delitem____SWIG_1(std::vector< std::pair< std::string,std::string > > *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<std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > >::difference_type id = i;
      std::vector<std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN std::vector< std::pair< std::string,std::string > >::value_type const &std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__Sg____getitem____SWIG_1(std::vector< std::pair< std::string,std::string > > const *self,std::vector< std::pair< std::string,std::string > >::difference_type i){
      return *(swig::cgetpos(self, i));
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__Sg____setitem____SWIG_2(std::vector< std::pair< std::string,std::string > > *self,std::vector< std::pair< std::string,std::string > >::difference_type i,std::vector< std::pair< std::string,std::string > >::value_type const &x){
      *(swig::getpos(self,i)) = x;
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__Sg__append(std::vector< std::pair< std::string,std::string > > *self,std::vector< std::pair< std::string,std::string > >::value_type const &x){
      self->push_back(x);
    }
SWIGINTERN std::vector< std::pair< std::string,std::string > >::iterator std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__Sg__erase__SWIG_0(std::vector< std::pair< std::string,std::string > > *self,std::vector< std::pair< std::string,std::string > >::iterator pos){ return self->erase(pos); }
SWIGINTERN std::vector< std::pair< std::string,std::string > >::iterator std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__Sg__erase__SWIG_1(std::vector< std::pair< std::string,std::string > > *self,std::vector< std::pair< std::string,std::string > >::iterator first,std::vector< std::pair< std::string,std::string > >::iterator last){ return self->erase(first, last); }
SWIGINTERN std::vector< std::pair< std::string,std::string > >::iterator std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__Sg__insert__SWIG_0(std::vector< std::pair< std::string,std::string > > *self,std::vector< std::pair< std::string,std::string > >::iterator pos,std::vector< std::pair< std::string,std::string > >::value_type const &x){ return self->insert(pos, x); }
SWIGINTERN void std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__Sg__insert__SWIG_1(std::vector< std::pair< std::string,std::string > > *self,std::vector< std::pair< std::string,std::string > >::iterator pos,std::vector< std::pair< std::string,std::string > >::size_type n,std::vector< std::pair< std::string,std::string > >::value_type const &x){ self->insert(pos, n, x); }

      namespace swig {
	template <>  struct traits<std::vector<std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >, std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > > > {
	  typedef pointer_category category;
	  static const char* type_name() {
	    return "std::vector<" "std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >" "," "std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > >" " >";
	  }
	};
      }
    
SWIGINTERN swig::SwigPyIterator *std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__Sg__iterator(std::vector< std::map< std::string,std::string > > *self,PyObject **PYTHON_SELF){
      return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
    }
SWIGINTERN bool std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__Sg____nonzero__(std::vector< std::map< std::string,std::string > > const *self){
      return !(self->empty());
    }
SWIGINTERN bool std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__Sg____bool__(std::vector< std::map< std::string,std::string > > const *self){
      return !(self->empty());
    }
SWIGINTERN std::vector< std::map< std::string,std::string > >::size_type std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__Sg____len__(std::vector< std::map< std::string,std::string > > const *self){
      return self->size();
    }
SWIGINTERN std::vector< std::map< std::string,std::string > >::value_type std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__Sg__pop(std::vector< std::map< std::string,std::string > > *self){
      if (self->size() == 0)
	throw std::out_of_range("pop from empty container");
      std::vector<std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > >::value_type x = self->back();
      self->pop_back();
      return x;
    }
SWIGINTERN std::vector< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > > *std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__Sg____getslice__(std::vector< std::map< std::string,std::string > > *self,std::vector< std::map< std::string,std::string > >::difference_type i,std::vector< std::map< std::string,std::string > >::difference_type j){
      return swig::getslice(self, i, j, 1);
    }
SWIGINTERN void std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__Sg____setslice__(std::vector< std::map< std::string,std::string > > *self,std::vector< std::map< std::string,std::string > >::difference_type i,std::vector< std::map< std::string,std::string > >::difference_type j,std::vector< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > > const &v=std::vector< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > >()){
      swig::setslice(self, i, j, 1, v);
    }
SWIGINTERN void std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__Sg____delslice__(std::vector< std::map< std::string,std::string > > *self,std::vector< std::map< std::string,std::string > >::difference_type i,std::vector< std::map< std::string,std::string > >::difference_type j){
      swig::delslice(self, i, j, 1);
    }
SWIGINTERN void std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__Sg____delitem____SWIG_0(std::vector< std::map< std::string,std::string > > *self,std::vector< std::map< std::string,std::string > >::difference_type i){
      self->erase(swig::getpos(self,i));
    }
SWIGINTERN std::vector< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > > *std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__Sg____getitem____SWIG_0(std::vector< std::map< std::string,std::string > > *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<std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > >::difference_type id = i;
      std::vector<std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > >::difference_type jd = j;
      return swig::getslice(self, id, jd, step);
    }
SWIGINTERN void std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__Sg____setitem____SWIG_0(std::vector< std::map< std::string,std::string > > *self,PySliceObject *slice,std::vector< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > > 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<std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > >::difference_type id = i;
      std::vector<std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > >::difference_type jd = j;
      swig::setslice(self, id, jd, step, v);
    }
SWIGINTERN void std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__Sg____setitem____SWIG_1(std::vector< std::map< std::string,std::string > > *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<std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > >::difference_type id = i;
      std::vector<std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN void std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__Sg____delitem____SWIG_1(std::vector< std::map< std::string,std::string > > *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<std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > >::difference_type id = i;
      std::vector<std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN std::vector< std::map< std::string,std::string > >::value_type const &std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__Sg____getitem____SWIG_1(std::vector< std::map< std::string,std::string > > const *self,std::vector< std::map< std::string,std::string > >::difference_type i){
      return *(swig::cgetpos(self, i));
    }
SWIGINTERN void std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__Sg____setitem____SWIG_2(std::vector< std::map< std::string,std::string > > *self,std::vector< std::map< std::string,std::string > >::difference_type i,std::vector< std::map< std::string,std::string > >::value_type const &x){
      *(swig::getpos(self,i)) = x;
    }
SWIGINTERN void std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__Sg__append(std::vector< std::map< std::string,std::string > > *self,std::vector< std::map< std::string,std::string > >::value_type const &x){
      self->push_back(x);
    }
SWIGINTERN std::vector< std::map< std::string,std::string > >::iterator std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__Sg__erase__SWIG_0(std::vector< std::map< std::string,std::string > > *self,std::vector< std::map< std::string,std::string > >::iterator pos){ return self->erase(pos); }
SWIGINTERN std::vector< std::map< std::string,std::string > >::iterator std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__Sg__erase__SWIG_1(std::vector< std::map< std::string,std::string > > *self,std::vector< std::map< std::string,std::string > >::iterator first,std::vector< std::map< std::string,std::string > >::iterator last){ return self->erase(first, last); }
SWIGINTERN std::vector< std::map< std::string,std::string > >::iterator std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__Sg__insert__SWIG_0(std::vector< std::map< std::string,std::string > > *self,std::vector< std::map< std::string,std::string > >::iterator pos,std::vector< std::map< std::string,std::string > >::value_type const &x){ return self->insert(pos, x); }
SWIGINTERN void std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__Sg__insert__SWIG_1(std::vector< std::map< std::string,std::string > > *self,std::vector< std::map< std::string,std::string > >::iterator pos,std::vector< std::map< std::string,std::string > >::size_type n,std::vector< std::map< std::string,std::string > >::value_type const &x){ self->insert(pos, n, x); }

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

      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 swig::SwigPyIterator *std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__iterator(std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *self,PyObject **PYTHON_SELF){
      return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
    }
SWIGINTERN bool std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg____nonzero__(std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > const *self){
      return !(self->empty());
    }
SWIGINTERN bool std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg____bool__(std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > const *self){
      return !(self->empty());
    }
SWIGINTERN std::vector< std::pair< unsigned int,unsigned int > >::size_type std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg____len__(std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > const *self){
      return self->size();
    }
SWIGINTERN std::vector< std::pair< unsigned int,unsigned int > >::value_type std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__pop(std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *self){
      if (self->size() == 0)
	throw std::out_of_range("pop from empty container");
      std::vector<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >::value_type x = self->back();
      self->pop_back();
      return x;
    }
SWIGINTERN std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > *std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg____getslice__(std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *self,std::vector< std::pair< unsigned int,unsigned int > >::difference_type i,std::vector< std::pair< unsigned int,unsigned int > >::difference_type j){
      return swig::getslice(self, i, j, 1);
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg____setslice__(std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *self,std::vector< std::pair< unsigned int,unsigned int > >::difference_type i,std::vector< std::pair< unsigned int,unsigned int > >::difference_type j,std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > const &v=std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >()){
      swig::setslice(self, i, j, 1, v);
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg____delslice__(std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *self,std::vector< std::pair< unsigned int,unsigned int > >::difference_type i,std::vector< std::pair< unsigned int,unsigned int > >::difference_type j){
      swig::delslice(self, i, j, 1);
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg____delitem____SWIG_0(std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *self,std::vector< std::pair< unsigned int,unsigned int > >::difference_type i){
      self->erase(swig::getpos(self,i));
    }
SWIGINTERN std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > *std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg____getitem____SWIG_0(std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *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<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >::difference_type id = i;
      std::vector<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >::difference_type jd = j;
      return swig::getslice(self, id, jd, step);
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg____setitem____SWIG_0(std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *self,PySliceObject *slice,std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > 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<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >::difference_type id = i;
      std::vector<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >::difference_type jd = j;
      swig::setslice(self, id, jd, step, v);
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg____setitem____SWIG_1(std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *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<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >::difference_type id = i;
      std::vector<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg____delitem____SWIG_1(std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *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<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >::difference_type id = i;
      std::vector<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN std::vector< std::pair< unsigned int,unsigned int > >::value_type const &std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg____getitem____SWIG_1(std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > const *self,std::vector< std::pair< unsigned int,unsigned int > >::difference_type i){
      return *(swig::cgetpos(self, i));
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg____setitem____SWIG_2(std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *self,std::vector< std::pair< unsigned int,unsigned int > >::difference_type i,std::vector< std::pair< unsigned int,unsigned int > >::value_type const &x){
      *(swig::getpos(self,i)) = x;
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__append(std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *self,std::vector< std::pair< unsigned int,unsigned int > >::value_type const &x){
      self->push_back(x);
    }
SWIGINTERN std::vector< std::pair< unsigned int,unsigned int > >::iterator std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__erase__SWIG_0(std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *self,std::vector< std::pair< unsigned int,unsigned int > >::iterator pos){ return self->erase(pos); }
SWIGINTERN std::vector< std::pair< unsigned int,unsigned int > >::iterator std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__erase__SWIG_1(std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *self,std::vector< std::pair< unsigned int,unsigned int > >::iterator first,std::vector< std::pair< unsigned int,unsigned int > >::iterator last){ return self->erase(first, last); }
SWIGINTERN std::vector< std::pair< unsigned int,unsigned int > >::iterator std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__insert__SWIG_0(std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *self,std::vector< std::pair< unsigned int,unsigned int > >::iterator pos,std::vector< std::pair< unsigned int,unsigned int > >::value_type const &x){ return self->insert(pos, x); }
SWIGINTERN void std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__insert__SWIG_1(std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *self,std::vector< std::pair< unsigned int,unsigned int > >::iterator pos,std::vector< std::pair< unsigned int,unsigned int > >::size_type n,std::vector< std::pair< unsigned int,unsigned int > >::value_type const &x){ self->insert(pos, n, x); }

      namespace swig {
	template <>  struct traits<std::vector<std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >, std::allocator< 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::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >" "," "std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > >" " >";
	  }
	};
      }
    
SWIGINTERN swig::SwigPyIterator *std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__Sg__iterator(std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *self,PyObject **PYTHON_SELF){
      return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
    }
SWIGINTERN bool std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__Sg____nonzero__(std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > const *self){
      return !(self->empty());
    }
SWIGINTERN bool std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__Sg____bool__(std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > const *self){
      return !(self->empty());
    }
SWIGINTERN std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__Sg____len__(std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > const *self){
      return self->size();
    }
SWIGINTERN std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__Sg__pop(std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *self){
      if (self->size() == 0)
	throw std::out_of_range("pop from empty container");
      std::vector<std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > >::value_type x = self->back();
      self->pop_back();
      return x;
    }
SWIGINTERN std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > > *std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__Sg____getslice__(std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *self,std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type i,std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type j){
      return swig::getslice(self, i, j, 1);
    }
SWIGINTERN void std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__Sg____setslice__(std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *self,std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type i,std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type j,std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > > const &v=std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > >()){
      swig::setslice(self, i, j, 1, v);
    }
SWIGINTERN void std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__Sg____delslice__(std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *self,std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type i,std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type j){
      swig::delslice(self, i, j, 1);
    }
SWIGINTERN void std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__Sg____delitem____SWIG_0(std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *self,std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type i){
      self->erase(swig::getpos(self,i));
    }
SWIGINTERN std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > > *std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__Sg____getitem____SWIG_0(std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *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<std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > >::difference_type id = i;
      std::vector<std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > >::difference_type jd = j;
      return swig::getslice(self, id, jd, step);
    }
SWIGINTERN void std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__Sg____setitem____SWIG_0(std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *self,PySliceObject *slice,std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > > 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<std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > >::difference_type id = i;
      std::vector<std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > >::difference_type jd = j;
      swig::setslice(self, id, jd, step, v);
    }
SWIGINTERN void std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__Sg____setitem____SWIG_1(std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *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<std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > >::difference_type id = i;
      std::vector<std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN void std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__Sg____delitem____SWIG_1(std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *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<std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > >::difference_type id = i;
      std::vector<std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type const &std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__Sg____getitem____SWIG_1(std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > const *self,std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type i){
      return *(swig::cgetpos(self, i));
    }
SWIGINTERN void std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__Sg____setitem____SWIG_2(std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *self,std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type i,std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type const &x){
      *(swig::getpos(self,i)) = x;
    }
SWIGINTERN void std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__Sg__append(std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *self,std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type const &x){
      self->push_back(x);
    }
SWIGINTERN std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__Sg__erase__SWIG_0(std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *self,std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator pos){ return self->erase(pos); }
SWIGINTERN std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__Sg__erase__SWIG_1(std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *self,std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator first,std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator last){ return self->erase(first, last); }
SWIGINTERN std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__Sg__insert__SWIG_0(std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *self,std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator pos,std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type const &x){ return self->insert(pos, x); }
SWIGINTERN void std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__Sg__insert__SWIG_1(std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *self,std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator pos,std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type n,std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type const &x){ self->insert(pos, n, x); }

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

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

      namespace swig {
	template <>  struct traits<std::vector<std::pair< nupic::UInt32,nupic::Real32 >, std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > > > {
	  typedef pointer_category category;
	  static const char* type_name() {
	    return "std::vector<" "std::pair< nupic::UInt32,nupic::Real32 >" "," "std::allocator< std::pair< nupic::UInt32,nupic::Real32 > >" " >";
	  }
	};
      }
    
SWIGINTERN swig::SwigPyIterator *std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__Sg__iterator(std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *self,PyObject **PYTHON_SELF){
      return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
    }
SWIGINTERN bool std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__Sg____nonzero__(std::vector< std::pair< nupic::UInt32,nupic::Real32 > > const *self){
      return !(self->empty());
    }
SWIGINTERN bool std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__Sg____bool__(std::vector< std::pair< nupic::UInt32,nupic::Real32 > > const *self){
      return !(self->empty());
    }
SWIGINTERN std::vector< std::pair< unsigned int,float > >::size_type std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__Sg____len__(std::vector< std::pair< nupic::UInt32,nupic::Real32 > > const *self){
      return self->size();
    }
SWIGINTERN std::vector< std::pair< unsigned int,float > >::value_type std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__Sg__pop(std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *self){
      if (self->size() == 0)
	throw std::out_of_range("pop from empty container");
      std::vector<std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > >::value_type x = self->back();
      self->pop_back();
      return x;
    }
SWIGINTERN std::vector< std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > > *std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__Sg____getslice__(std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *self,std::vector< std::pair< unsigned int,float > >::difference_type i,std::vector< std::pair< unsigned int,float > >::difference_type j){
      return swig::getslice(self, i, j, 1);
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__Sg____setslice__(std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *self,std::vector< std::pair< unsigned int,float > >::difference_type i,std::vector< std::pair< unsigned int,float > >::difference_type j,std::vector< std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > > const &v=std::vector< std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > >()){
      swig::setslice(self, i, j, 1, v);
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__Sg____delslice__(std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *self,std::vector< std::pair< unsigned int,float > >::difference_type i,std::vector< std::pair< unsigned int,float > >::difference_type j){
      swig::delslice(self, i, j, 1);
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__Sg____delitem____SWIG_0(std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *self,std::vector< std::pair< unsigned int,float > >::difference_type i){
      self->erase(swig::getpos(self,i));
    }
SWIGINTERN std::vector< std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > > *std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__Sg____getitem____SWIG_0(std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *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<std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > >::difference_type id = i;
      std::vector<std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > >::difference_type jd = j;
      return swig::getslice(self, id, jd, step);
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__Sg____setitem____SWIG_0(std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *self,PySliceObject *slice,std::vector< std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > > 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<std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > >::difference_type id = i;
      std::vector<std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > >::difference_type jd = j;
      swig::setslice(self, id, jd, step, v);
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__Sg____setitem____SWIG_1(std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *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<std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > >::difference_type id = i;
      std::vector<std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__Sg____delitem____SWIG_1(std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *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<std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > >::difference_type id = i;
      std::vector<std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN std::vector< std::pair< unsigned int,float > >::value_type const &std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__Sg____getitem____SWIG_1(std::vector< std::pair< nupic::UInt32,nupic::Real32 > > const *self,std::vector< std::pair< unsigned int,float > >::difference_type i){
      return *(swig::cgetpos(self, i));
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__Sg____setitem____SWIG_2(std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *self,std::vector< std::pair< unsigned int,float > >::difference_type i,std::vector< std::pair< unsigned int,float > >::value_type const &x){
      *(swig::getpos(self,i)) = x;
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__Sg__append(std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *self,std::vector< std::pair< unsigned int,float > >::value_type const &x){
      self->push_back(x);
    }
SWIGINTERN std::vector< std::pair< unsigned int,float > >::iterator std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__Sg__erase__SWIG_0(std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *self,std::vector< std::pair< unsigned int,float > >::iterator pos){ return self->erase(pos); }
SWIGINTERN std::vector< std::pair< unsigned int,float > >::iterator std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__Sg__erase__SWIG_1(std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *self,std::vector< std::pair< unsigned int,float > >::iterator first,std::vector< std::pair< unsigned int,float > >::iterator last){ return self->erase(first, last); }
SWIGINTERN std::vector< std::pair< unsigned int,float > >::iterator std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__Sg__insert__SWIG_0(std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *self,std::vector< std::pair< unsigned int,float > >::iterator pos,std::vector< std::pair< unsigned int,float > >::value_type const &x){ return self->insert(pos, x); }
SWIGINTERN void std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__Sg__insert__SWIG_1(std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *self,std::vector< std::pair< unsigned int,float > >::iterator pos,std::vector< std::pair< unsigned int,float > >::size_type n,std::vector< std::pair< unsigned int,float > >::value_type const &x){ self->insert(pos, n, x); }

      namespace swig {
	template <>  struct traits<std::vector<std::pair< nupic::UInt32,nupic::Real64 >, std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > > > {
	  typedef pointer_category category;
	  static const char* type_name() {
	    return "std::vector<" "std::pair< nupic::UInt32,nupic::Real64 >" "," "std::allocator< std::pair< nupic::UInt32,nupic::Real64 > >" " >";
	  }
	};
      }
    
SWIGINTERN swig::SwigPyIterator *std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__Sg__iterator(std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *self,PyObject **PYTHON_SELF){
      return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
    }
SWIGINTERN bool std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__Sg____nonzero__(std::vector< std::pair< nupic::UInt32,nupic::Real64 > > const *self){
      return !(self->empty());
    }
SWIGINTERN bool std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__Sg____bool__(std::vector< std::pair< nupic::UInt32,nupic::Real64 > > const *self){
      return !(self->empty());
    }
SWIGINTERN std::vector< std::pair< unsigned int,double > >::size_type std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__Sg____len__(std::vector< std::pair< nupic::UInt32,nupic::Real64 > > const *self){
      return self->size();
    }
SWIGINTERN std::vector< std::pair< unsigned int,double > >::value_type std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__Sg__pop(std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *self){
      if (self->size() == 0)
	throw std::out_of_range("pop from empty container");
      std::vector<std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > >::value_type x = self->back();
      self->pop_back();
      return x;
    }
SWIGINTERN std::vector< std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > > *std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__Sg____getslice__(std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *self,std::vector< std::pair< unsigned int,double > >::difference_type i,std::vector< std::pair< unsigned int,double > >::difference_type j){
      return swig::getslice(self, i, j, 1);
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__Sg____setslice__(std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *self,std::vector< std::pair< unsigned int,double > >::difference_type i,std::vector< std::pair< unsigned int,double > >::difference_type j,std::vector< std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > > const &v=std::vector< std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > >()){
      swig::setslice(self, i, j, 1, v);
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__Sg____delslice__(std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *self,std::vector< std::pair< unsigned int,double > >::difference_type i,std::vector< std::pair< unsigned int,double > >::difference_type j){
      swig::delslice(self, i, j, 1);
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__Sg____delitem____SWIG_0(std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *self,std::vector< std::pair< unsigned int,double > >::difference_type i){
      self->erase(swig::getpos(self,i));
    }
SWIGINTERN std::vector< std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > > *std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__Sg____getitem____SWIG_0(std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *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<std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > >::difference_type id = i;
      std::vector<std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > >::difference_type jd = j;
      return swig::getslice(self, id, jd, step);
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__Sg____setitem____SWIG_0(std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *self,PySliceObject *slice,std::vector< std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > > 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<std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > >::difference_type id = i;
      std::vector<std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > >::difference_type jd = j;
      swig::setslice(self, id, jd, step, v);
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__Sg____setitem____SWIG_1(std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *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<std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > >::difference_type id = i;
      std::vector<std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__Sg____delitem____SWIG_1(std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *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<std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > >::difference_type id = i;
      std::vector<std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN std::vector< std::pair< unsigned int,double > >::value_type const &std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__Sg____getitem____SWIG_1(std::vector< std::pair< nupic::UInt32,nupic::Real64 > > const *self,std::vector< std::pair< unsigned int,double > >::difference_type i){
      return *(swig::cgetpos(self, i));
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__Sg____setitem____SWIG_2(std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *self,std::vector< std::pair< unsigned int,double > >::difference_type i,std::vector< std::pair< unsigned int,double > >::value_type const &x){
      *(swig::getpos(self,i)) = x;
    }
SWIGINTERN void std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__Sg__append(std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *self,std::vector< std::pair< unsigned int,double > >::value_type const &x){
      self->push_back(x);
    }
SWIGINTERN std::vector< std::pair< unsigned int,double > >::iterator std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__Sg__erase__SWIG_0(std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *self,std::vector< std::pair< unsigned int,double > >::iterator pos){ return self->erase(pos); }
SWIGINTERN std::vector< std::pair< unsigned int,double > >::iterator std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__Sg__erase__SWIG_1(std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *self,std::vector< std::pair< unsigned int,double > >::iterator first,std::vector< std::pair< unsigned int,double > >::iterator last){ return self->erase(first, last); }
SWIGINTERN std::vector< std::pair< unsigned int,double > >::iterator std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__Sg__insert__SWIG_0(std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *self,std::vector< std::pair< unsigned int,double > >::iterator pos,std::vector< std::pair< unsigned int,double > >::value_type const &x){ return self->insert(pos, x); }
SWIGINTERN void std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__Sg__insert__SWIG_1(std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *self,std::vector< std::pair< unsigned int,double > >::iterator pos,std::vector< std::pair< unsigned int,double > >::size_type n,std::vector< std::pair< unsigned int,double > >::value_type const &x){ self->insert(pos, n, x); }


#include <nupic/types/BasicType.hpp>

NTA_BasicType GetBasicTypeFromName(const std::string &type)
{
  return nupic::BasicType::parse(type);
}

size_t GetBasicTypeSize(const std::string &type)
{
  return nupic::BasicType::getSize(nupic::BasicType::parse(type));
}



#include <nupic/math/SparseMatrix.hpp>
#include <nupic/math/SparseMatrixAlgorithms.hpp>
#include <nupic/math/SparseBinaryMatrix.hpp>
#include <nupic/math/NearestNeighbor.hpp>
#include <nupic/proto/SparseMatrixProto.capnp.h>
#include <nupic/proto/SparseBinaryMatrixProto.capnp.h>
#include <py_support/PyCapnp.hpp>
#include <py_support/NumpyVector.hpp>
#include <py_support/PythonStream.hpp>


 

  nupic::Real getGlobalEpsilon() { return nupic::Epsilon; }



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;
}




SWIGINTERN nupic::Real32 nupic_LogSumApprox_logSum(nupic::LogSumApprox const *self,nupic::Real32 x,nupic::Real32 y){
    return self->sum_of_logs(x, y);
  }
SWIGINTERN nupic::Real32 nupic_LogSumApprox_fastLogSum(nupic::LogSumApprox const *self,nupic::Real32 x,nupic::Real32 y){
    return self->fast_sum_of_logs(x, y);
  }
SWIGINTERN nupic::Real32 nupic_LogDiffApprox_logDiff(nupic::LogDiffApprox const *self,nupic::Real32 x,nupic::Real32 y){
    return self->diff_of_logs(x, y);
  }
SWIGINTERN nupic::Real32 nupic_LogDiffApprox_fastLogDiff(nupic::LogDiffApprox const *self,nupic::Real32 x,nupic::Real32 y){
    return self->fast_diff_of_logs(x, y);
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg____initializeWithRows(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &other,PyObject *py_take){
    nupic::NumpyVectorT<nupic::UInt32> take(py_take);
    self->initializeWithRows(other, take.begin(), take.end());
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg____initializeWithCols(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &other,PyObject *py_take){
    nupic::NumpyVectorT<nupic::UInt32> take(py_take);
    self->initializeWithCols(other, take.begin(), take.end());
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg____add(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,PyObject *val){
    self->add(nupic::convertToValueType<nupic::Real32>(val));
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg____multiply(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,PyObject *val){
    self->multiply(nupic::convertToValueType<nupic::Real32>(val));
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg____subtract(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,PyObject *val){
    self->subtract(nupic::convertToValueType<nupic::Real32>(val));
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg____divide(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,PyObject *val){
    self->divide(nupic::convertToValueType<nupic::Real32>(val));
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__copy(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &other){
    self->copy(other);
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__fromDense(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,PyObject *matrix){
    nupic::NumpyMatrixT<nupic::Real32> m(matrix);
    self->fromDense(m.rows(), m.columns(), m.addressOf(0, 0));
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__toDense(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self){
    int dims[] = { static_cast<int>(self->nRows()), static_cast<int>(self->nCols()) };
    nupic::NumpyMatrixT<nupic::Real32> out(dims);
    self->toDense(out.addressOf(0, 0));
    return out.forPython();
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg___setRowFromDense(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,nupic::UInt32 row,PyObject *py_row){ 
    nupic::NumpyVectorT<nupic::Real32> row_data(py_row);
    self->setRowFromDense(row, row_data.begin());
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__setRowFromSparse(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,nupic::UInt32 row,PyObject *py_ind,PyObject *py_nz){
    nupic::NumpyVectorT<nupic::UInt32> ind(py_ind);
    nupic::NumpyVectorT<nupic::Real32> nz(py_nz);
    self->setRowFromSparse(row, ind.begin(), ind.end(), nz.begin());
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__binarySaveToFile(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,std::string const &filename){
    std::ofstream save_file(filename.c_str());
    self->toBinary(save_file);
    save_file.close();
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__binaryLoadFromFile(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,std::string const &filename){
    std::ifstream load_file(filename.c_str());
    self->fromBinary(load_file);
    load_file.close();
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__write__SWIG_1(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,PyObject *pyBuilder){
    SparseMatrixProto::Builder proto =
        nupic::getBuilder<SparseMatrixProto>(pyBuilder);
    self->write(proto);
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__read__SWIG_1(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,PyObject *pyReader){
    SparseMatrixProto::Reader proto =
        nupic::getReader<SparseMatrixProto>(pyReader);
    self->read(proto);
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__addRow(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,PyObject *row){
    nupic::NumpyVectorT<nupic::Real32> v(row);
    self->addRow(v.begin());
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__addRowNZ(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,PyObject *ind,PyObject *nz,bool zero_permissive=false){
    nupic::NumpyVectorT<nupic::UInt32> cpp_ind(ind);
    nupic::NumpyVectorT<nupic::Real32> cpp_nz(nz);
    self->addRow(cpp_ind.begin(), cpp_ind.end(), cpp_nz.begin(),
		 zero_permissive);
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__addCol(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,PyObject *col){
    nupic::NumpyVectorT<nupic::Real32> cpp_col(col);
    self->addCol(cpp_col.begin());
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__addColNZ(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,PyObject *ind,PyObject *nz){
    nupic::NumpyVectorT<nupic::UInt32> cpp_ind(ind);
    nupic::NumpyVectorT<nupic::Real32> cpp_nz(nz);
    self->addCol(cpp_ind.begin(), cpp_ind.end(), cpp_nz.begin());
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__deleteRows(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,PyObject *rowIndices){
    nupic::NumpyVectorT<nupic::UInt32> cpp_rowIndices(rowIndices);
    self->deleteRows(cpp_rowIndices.begin(), cpp_rowIndices.end());
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__deleteCols(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,PyObject *colIndices){
    nupic::NumpyVectorT<nupic::UInt32> cpp_colIndices(colIndices);
    self->deleteCols(cpp_colIndices.begin(), cpp_colIndices.end());
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__getRow(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,nupic::UInt32 row){
    const nupic::UInt32 ncols = self->nCols();
    nupic::NumpyVectorT<nupic::Real32> dense_row(ncols);
    self->getRowToDense(row, dense_row.begin());
    return dense_row.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__getCol(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,nupic::UInt32 col){
    const nupic::UInt32 nrows = self->nRows();
    nupic::NumpyVectorT<nupic::Real32> dense_col(nrows);
    self->getColToDense(col, dense_col.begin());
    return dense_col.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__getDiagonal(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self){
    const nupic::UInt32 nrows = self->nRows();
    nupic::NumpyVectorT<nupic::Real32> diag(nrows);
    self->getDiagonalToDense(diag.begin());
    return diag.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rowNonZeros(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,nupic::UInt32 row){
    const nupic::UInt32 n = self->nNonZerosOnRow(row);
    std::vector<nupic::UInt32> ind(n);
    nupic::NumpyVectorT<nupic::Real32> val(n);
    self->getRowToSparse(row, ind.begin(), val.begin());
    PyObject *toReturn = PyTuple_New(2);
    PyTuple_SET_ITEM(toReturn, 0, nupic::PyInt32Vector(ind.begin(), ind.end()));
    PyTuple_SET_ITEM(toReturn, 1, val.forPython());
    return toReturn;
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rowNonZeroIndices(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,nupic::UInt32 row){
    const nupic::UInt32 n = self->nNonZerosOnRow(row);
    nupic::NumpyVectorT<nupic::UInt32> ind(n);
    self->getRowIndicesToSparse(row, ind.begin());
    return ind.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__colNonZeros(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,nupic::UInt32 col){
    const nupic::UInt32 n = self->nNonZerosOnCol(col);
    std::vector<nupic::UInt32> ind(n);
    nupic::NumpyVectorT<nupic::Real32> val(n);
    self->getColToSparse(col, ind.begin(), val.begin());
    PyObject *toReturn = PyTuple_New(2);
    PyTuple_SET_ITEM(toReturn, 0, nupic::PyInt32Vector(ind.begin(), ind.end()));
    PyTuple_SET_ITEM(toReturn, 1, val.forPython());
    return toReturn;
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__nonZeroRows(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self){
    const nupic::UInt32 nNonZeroRows = self->nNonZeroRows();
    nupic::NumpyVectorT<nupic::UInt32> nzRows(nNonZeroRows);
    self->nonZeroRows(nzRows.begin());
    return nzRows.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__zeroRows(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self){
    const nupic::UInt32 nZeroRows = self->nZeroRows();
    nupic::NumpyVectorT<nupic::UInt32> zRows(nZeroRows);
    self->zeroRows(zRows.begin());
    return zRows.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__nonZeroCols(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self){
    const nupic::UInt32 nNonZeroCols = self->nNonZeroCols();
    nupic::NumpyVectorT<nupic::UInt32> nzCols(nNonZeroCols);
    self->nonZeroCols(nzCols.begin());
    return nzCols.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__zeroCols(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self){
    const nupic::UInt32 nZeroCols = self->nZeroCols();
    nupic::NumpyVectorT<nupic::UInt32> zCols(nZeroCols);
    self->zeroCols(zCols.begin());
    return zCols.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__zeroRowAndCol(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self){
    std::vector<nupic::UInt32> zrc;
    nupic::UInt32 c = self->zeroRowAndCol(std::back_inserter(zrc));
    nupic::NumpyVectorT<nupic::UInt32> toReturn(c);
    std::copy(zrc.begin(), zrc.end(), toReturn.begin());
    return toReturn.forPython();
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__setElements(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,PyObject *py_i,PyObject *py_j,PyObject *py_v){
    const nupic::NumpyVectorT<nupic::UInt32> i(py_i), j(py_j);
    const nupic::NumpyVectorT<nupic::Real32> v(py_v);
    self->setElements(i.begin(), i.end(), j.begin(), v.begin());
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__getElements(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,PyObject *py_i,PyObject *py_j){
    const nupic::NumpyVectorT<nupic::UInt32> i(py_i), j(py_j);
    nupic::NumpyVectorT<nupic::Real32> v(i.size());
    self->getElements(i.begin(), i.end(), j.begin(), v.begin());
    return v.forPython();
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__setOuter(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,PyObject *py_i,PyObject *py_j,PyObject *py_v){
    const nupic::NumpyVectorT<nupic::UInt32> i(py_i), j(py_j);
    const nupic::NumpyMatrixT<nupic::Real32> v(py_v);
    self->setOuter(i.begin(), i.end(), j.begin(), j.end(), v);
  }
SWIGINTERN nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__getOuter(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,PyObject *py_i,PyObject *py_j){
    const nupic::NumpyVectorT<nupic::UInt32> i(py_i), j(py_j);
    nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > > v(i.size(), j.size());
    self->getOuter(i.begin(), i.end(), j.begin(), j.end(), v);
    return v;
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__getAllNonZeros(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,bool three_lists=false){
    const nupic::UInt32 nnz = self->nNonZeros();
    nupic::NumpyVectorT<nupic::UInt32> rows(nnz), cols(nnz);
    nupic::NumpyVectorT<nupic::Real32> vals(nnz);

    self->getAllNonZeros(rows.begin(), cols.begin(), vals.begin());

    PyObject* toReturn = NULL;

    if (!three_lists) {
      // Return one list of triples
      toReturn = PyTuple_New(nnz);
      for (nupic::UInt32 i = 0; i != nnz; ++i) {
	PyObject* tuple = nupic::createTriplet32(rows.get(i), cols.get(i), vals.get(i));
	PyTuple_SET_ITEM(toReturn, i, tuple);
      }
    } else {
      // Return three lists
      toReturn = PyTuple_New(3);
      PyTuple_SET_ITEM(toReturn, 0, rows.forPython());
      PyTuple_SET_ITEM(toReturn, 1, cols.forPython());
      PyTuple_SET_ITEM(toReturn, 2, vals.forPython());
    }

    return toReturn;
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__setAllNonZeros(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,nupic::UInt32 nrows,nupic::UInt32 ncols,PyObject *py_i,PyObject *py_j,PyObject *py_v,bool sorted=true){
    nupic::NumpyVectorT<nupic::UInt32> i(py_i), j(py_j);
    nupic::NumpyVectorT<nupic::Real32> v(py_v);
    self->setAllNonZeros(nrows, ncols,
			 i.begin(), i.end(),
			 j.begin(), j.end(),
			 v.begin(), v.end(),
			 sorted);
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__getNonZerosInBox(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,nupic::UInt32 row_begin,nupic::UInt32 row_end,nupic::UInt32 col_begin,nupic::UInt32 col_end){
    std::vector<nupic::UInt32> rows, cols;
    std::vector<nupic::Real32> vals;
    self->getNonZerosInBox(row_begin, row_end, col_begin, col_end,
			   std::back_inserter(rows),
			   std::back_inserter(cols),
			   std::back_inserter(vals));
    PyObject* toReturn = PyList_New(rows.size());
    for (nupic::UInt32 i = 0; i != rows.size(); ++i) {
      PyObject* tuple = nupic::createTriplet32(rows[i], cols[i], vals[i]);
      PyList_SET_ITEM(toReturn, i, tuple);
    }
    return toReturn;
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__tolist(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self){
    const nupic::UInt32 nnz = self->nNonZeros();
    std::vector<nupic::UInt32> rows(nnz), cols(nnz);
    nupic::NumpyVectorT<nupic::Real32> vals(nnz);
    self->getAllNonZeros(rows.begin(), cols.begin(), vals.begin());

    PyObject* ind_list = PyTuple_New(nnz);
    for (nupic::UInt32 i = 0; i != nnz; ++i) {
      PyObject* idx = PyTuple_New(2);
      PyTuple_SET_ITEM(idx, 0, PyInt_FromLong(rows[i]));
      PyTuple_SET_ITEM(idx, 1, PyInt_FromLong(cols[i]));
      PyTuple_SET_ITEM(ind_list, i, idx);
    }
    PyObject* toReturn = PyTuple_New(2);
    PyTuple_SET_ITEM(toReturn, 0, ind_list);
    PyTuple_SET_ITEM(toReturn, 1, vals.forPython());
    return toReturn;
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__setSlice__SWIG_1(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,nupic::UInt32 i_begin,nupic::UInt32 j_begin,nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &other){
    self->setSlice(i_begin, j_begin, other);
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__setSlice__SWIG_2(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,nupic::UInt32 i_begin,nupic::UInt32 j_begin,PyObject *py_other){
    nupic::NumpyMatrixT<nupic::Real32> other(py_other);
    self->setSlice(i_begin, j_begin, other);
  }
SWIGINTERN nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__getSlice(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,nupic::UInt32 i_begin,nupic::UInt32 i_end,nupic::UInt32 j_begin,nupic::UInt32 j_end){
    nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > > other(i_end - i_begin, j_end - j_begin);
    self->getSlice(i_begin, i_end, j_begin, j_end, other);
    return other;
  }
SWIGINTERN nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__getSlice2__SWIG_1(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,nupic::UInt32 i_begin,nupic::UInt32 i_end,nupic::UInt32 j_begin,nupic::UInt32 j_end){
    nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > > other(i_end - i_begin, j_end - j_begin);
    self->getSlice2(i_begin, i_end, j_begin, j_end, other);
    return other;
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__setRowsToZero(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,PyObject *py_rows){
    nupic::NumpyVectorT<nupic::UInt32> rows(py_rows);
    self->setRowsToZero(rows.begin(), rows.end());
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__setColsToZero(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,PyObject *py_cols){
    nupic::NumpyVectorT<nupic::UInt32> cols(py_cols);
    self->setColsToZero(cols.begin(), cols.end());
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__setDiagonal(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,PyObject *py_v){
    nupic::NumpyVectorT<nupic::Real32> v(py_v);
    self->setDiagonal(v.begin());
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__incrementOnOuterWNZ(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,PyObject *py_i,PyObject *py_j,nupic::Real32 delta=1){
    nupic::NumpyVectorT<nupic::UInt32> i(py_i), j(py_j);
    self->incrementOnOuterWNZ(i.begin(), i.end(), j.begin(), j.end(), delta);
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__incrementOnOuterWNZWThreshold(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,PyObject *py_i,PyObject *py_j,nupic::Real32 threshold,nupic::Real32 delta=1){
    nupic::NumpyVectorT<nupic::UInt32> i(py_i), j(py_j);
    self->incrementOnOuterWNZWThreshold(i.begin(), i.end(), j.begin(), j.end(), 
                                        threshold, delta);
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__nNonZerosPerRow(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self){
    nupic::NumpyVectorT<nupic::UInt32> nnzpr(self->nRows());
    self->nNonZerosPerRow(nnzpr.begin());
    return nnzpr.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__nNonZerosPerCol(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self){
    nupic::NumpyVectorT<nupic::UInt32> nnzpc(self->nCols());
    self->nNonZerosPerCol(nnzpc.begin());
    return nnzpc.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rowBandwidths(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self){
    nupic::NumpyVectorT<nupic::UInt32> nnzpc(self->nRows());
    self->rowBandwidths(nnzpc.begin());
    return nnzpc.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__colBandwidths(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self){
    nupic::NumpyVectorT<nupic::UInt32> nnzpc(self->nCols());
    self->colBandwidths(nnzpc.begin());
    return nnzpc.forPython();
  }
SWIGINTERN nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__nNonZerosPerBox(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,PyObject *box_i,PyObject *box_j){
      nupic::NumpyVectorT<nupic::UInt32> bounds_i(box_i);
      nupic::NumpyVectorT<nupic::UInt32> bounds_j(box_j);
      nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > > result(bounds_i.size(), bounds_j.size());
      self->nNonZerosPerBox(bounds_i.begin(), bounds_i.end(),
			    bounds_j.begin(), bounds_j.end(), 
			    result);
      return result;
    }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__max__SWIG_1(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self){
    nupic::UInt32 max_row, max_col;
    nupic::Real32 max_val;
    self->max(max_row, max_col, max_val);
    return nupic::createTriplet32(max_row, max_col, max_val);
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__min__SWIG_1(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self){
    nupic::UInt32 min_row, min_col;
    nupic::Real32 min_val;
    self->min(min_row, min_col, min_val);
    return nupic::createTriplet32(min_row, min_col, min_val);
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rowMin__SWIG_3(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,nupic::UInt32 row_index){
    nupic::UInt32 idx;
    nupic::Real32 min_val;
    self->rowMin(row_index, idx, min_val);
    return nupic::createPair32(idx, min_val);
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rowMax__SWIG_3(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,nupic::UInt32 row_index){
    nupic::UInt32 idx;
    nupic::Real32 max_val;
    self->rowMax(row_index, idx, max_val);
    return nupic::createPair32(idx, max_val);
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__colMin__SWIG_3(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,nupic::UInt32 col_index){
    nupic::UInt32 idx;
    nupic::Real32 min_val;
    self->colMin(col_index, idx, min_val);
    return nupic::createPair32(idx, min_val);
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__colMax__SWIG_3(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,nupic::UInt32 row_index){
    nupic::UInt32 idx;
    nupic::Real32 max_val;
    self->colMax(row_index, idx, max_val);
    return nupic::createPair32(idx, max_val);
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rowMax__SWIG_4(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self){
    nupic::UInt32 n = self->nRows();
    std::vector<nupic::UInt32> ind(n);
    nupic::NumpyVectorT<nupic::Real32> val(n);
    self->rowMax(ind.begin(), val.begin());
    PyObject *toReturn = PyTuple_New(2);
    PyTuple_SET_ITEM(toReturn, 0, nupic::PyInt32Vector(ind.begin(), ind.end()));
    PyTuple_SET_ITEM(toReturn, 1, val.forPython());
    return toReturn;
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rowMin__SWIG_4(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self){
    nupic::UInt32 n = self->nRows();
    std::vector<nupic::UInt32> ind(n);
    nupic::NumpyVectorT<nupic::Real32> val(n);
    self->rowMin(ind.begin(), val.begin());
    PyObject *toReturn = PyTuple_New(2);
    PyTuple_SET_ITEM(toReturn, 0, nupic::PyInt32Vector(ind.begin(), ind.end()));
    PyTuple_SET_ITEM(toReturn, 1, val.forPython());
    return toReturn;
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__colMax__SWIG_4(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self){
    nupic::UInt32 n = self->nCols();
    std::vector<nupic::UInt32> ind(n);
    nupic::NumpyVectorT<nupic::Real32> val(n);
    self->colMax(ind.begin(), val.begin());
    PyObject *toReturn = PyTuple_New(2);
    PyTuple_SET_ITEM(toReturn, 0, nupic::PyInt32Vector(ind.begin(), ind.end()));
    PyTuple_SET_ITEM(toReturn, 1, val.forPython());
    return toReturn;
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__colMin__SWIG_4(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self){
    nupic::UInt32 n = self->nCols();
    std::vector<nupic::UInt32> ind(n);
    nupic::NumpyVectorT<nupic::Real32> val(n);
    self->colMin(ind.begin(), val.begin());
    PyObject *toReturn = PyTuple_New(2);
    PyTuple_SET_ITEM(toReturn, 0, nupic::PyInt32Vector(ind.begin(), ind.end()));
    PyTuple_SET_ITEM(toReturn, 1, val.forPython());
    return toReturn;
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__boxMin__SWIG_1(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,nupic::UInt32 begin_row,nupic::UInt32 end_row,nupic::UInt32 begin_col,nupic::UInt32 end_col){
    nupic::UInt32 min_row, min_col;
    nupic::Real32 min_val;
    self->boxMin(begin_row, end_row, begin_col, end_col, min_row, min_col, min_val);
    return nupic::createTriplet32(min_row, min_col, min_val);
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__boxMax__SWIG_1(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,nupic::UInt32 begin_row,nupic::UInt32 end_row,nupic::UInt32 begin_col,nupic::UInt32 end_col){
    nupic::UInt32 max_row, max_col;
    nupic::Real32 max_val;
    self->boxMax(begin_row, end_row, begin_col, end_col, max_row, max_col, max_val);
    return nupic::createTriplet32(max_row, max_col, max_val);
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__whereEqual(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,nupic::UInt32 begin_row,nupic::UInt32 end_row,nupic::UInt32 begin_col,nupic::UInt32 end_col,nupic::Real32 const &value){
    std::vector<nupic::UInt32> rows, cols;
    self->whereEqual(begin_row, end_row, begin_col, end_col, value, 
		     std::back_inserter(rows), std::back_inserter(cols));

    PyObject* toReturn = PyTuple_New(rows.size());    

    for (size_t i = 0; i != rows.size(); ++i) {
      PyObject* p = PyTuple_New(2);
      PyTuple_SET_ITEM(p, 0, PyInt_FromLong(rows[i]));
      PyTuple_SET_ITEM(p, 1, PyInt_FromLong(cols[i]));
      PyTuple_SET_ITEM(toReturn, i, p);
    }

    return toReturn;
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__whereGreater(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,nupic::UInt32 begin_row,nupic::UInt32 end_row,nupic::UInt32 begin_col,nupic::UInt32 end_col,nupic::Real32 const &value){
    std::vector<nupic::UInt32> rows, cols;
    self->whereGreater(begin_row, end_row, begin_col, end_col, value, 
		       std::back_inserter(rows), std::back_inserter(cols));

    int dims[] = {static_cast<int>(rows.size()), 2};
    nupic::NumpyMatrixT<nupic::UInt32> toReturn(dims);
    for (size_t i = 0; i != rows.size(); ++i) {  
      toReturn.set(i, 0, rows[i]);
      toReturn.set(i, 1, cols[i]);
    }
    return toReturn.forPython();

    /*
    PyObject* toReturn = PyTuple_New(rows.size());    
    for (size_t i = 0; i != rows.size(); ++i) {
      PyObject* p = PyTuple_New(2);
      PyTuple_SET_ITEM(p, 0, PyInt_FromLong(rows[i]));
      PyTuple_SET_ITEM(p, 1, PyInt_FromLong(cols[i]));
      PyTuple_SET_ITEM(toReturn, i, p);
    }

    return toReturn;
    */
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__whereGreaterEqual(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,nupic::UInt32 begin_row,nupic::UInt32 end_row,nupic::UInt32 begin_col,nupic::UInt32 end_col,nupic::Real32 const &value){
    std::vector<nupic::UInt32> rows, cols;
    self->whereGreaterEqual(begin_row, end_row, begin_col, end_col, value, 
                            std::back_inserter(rows), std::back_inserter(cols));
    
    
    int dims[] = {static_cast<int>(rows.size()), 2};
    nupic::NumpyMatrixT<nupic::UInt32> toReturn(dims);
    for (size_t i = 0; i != rows.size(); ++i) {  
      toReturn.set(i, 0, rows[i]);
      toReturn.set(i, 1, cols[i]);
    }
    return toReturn.forPython();

    /*
    PyObject* toReturn = PyTuple_New(rows.size());    

    for (size_t i = 0; i != rows.size(); ++i) {
      PyObject* p = PyTuple_New(2);
      PyTuple_SET_ITEM(p, 0, PyInt_FromLong(rows[i]));
      PyTuple_SET_ITEM(p, 1, PyInt_FromLong(cols[i]));
      PyTuple_SET_ITEM(toReturn, i, p);
    }
    return toReturn;
    */

  }
SWIGINTERN nupic::UInt32 nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__countWhereGreaterOrEqual(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,nupic::UInt32 begin_row,nupic::UInt32 end_row,nupic::UInt32 begin_col,nupic::UInt32 end_col,nupic::Real32 const &value){
    std::vector<nupic::UInt32> rows, cols;
    return self->countWhereGreaterEqual(begin_row, end_row, begin_col, end_col, value);
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__permuteRows(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,PyObject *py_permutation){
    nupic::NumpyVectorT<nupic::UInt32> p(py_permutation);
    self->permuteRows(p.begin());
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__permuteCols(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,PyObject *py_permutation){
    nupic::NumpyVectorT<nupic::UInt32> p(py_permutation);
    self->permuteCols(p.begin());
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rowSums__SWIG_2(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self){
    nupic::NumpyVectorT<nupic::Real32> m(self->nRows());
    self->rowSums(m.begin());
    return m.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__colSums(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self){
    nupic::NumpyVectorT<nupic::Real32> m(self->nCols());
    self->colSums(m.begin());
    return m.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__addRows(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,PyObject *whichRows){
    nupic::NumpyVectorT<nupic::UInt32> indicator(whichRows);
    nupic::NumpyVectorT<nupic::Real32> res(self->nCols());
    self->addRows(indicator.begin(), indicator.end(), res.begin(), res.end());
    return res.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__addListOfRows(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,PyObject *py_whichRows){
    nupic::NumpyVectorT<nupic::UInt32> whichRows(py_whichRows);
    nupic::NumpyVectorT<nupic::Real32> res(self->nCols());
    self->addListOfRows(whichRows.begin(), whichRows.end(), res.begin(), res.end());
    return res.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rowProds(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self){
    nupic::NumpyVectorT<nupic::Real32> m(self->nRows());
    self->rowProds(m.begin());
    return m.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__colProds(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self){
    nupic::NumpyVectorT<nupic::Real32> m(self->nCols());
    self->colProds(m.begin());
    return m.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__logRowSums(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self){
    nupic::NumpyVectorT<nupic::Real32> m(self->nRows());
    self->logRowSums(m.begin(), m.end());
    return m.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__logColSums(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self){
    nupic::NumpyVectorT<nupic::Real32> m(self->nCols());
    self->logColSums(m.begin(), m.end());
    return m.forPython();
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__scaleRows(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,PyObject *py_s){
    nupic::NumpyVectorT<nupic::Real32> s(py_s);
    self->scaleRows(s.begin());
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__scaleCols(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,PyObject *py_s){
    nupic::NumpyVectorT<nupic::Real32> s(py_s);
    self->scaleCols(s.begin());
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__normalizeBlockByRows(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,PyObject *py_inds,nupic::Real32 val=-1.0,nupic::Real32 eps_n=1e-6){
    nupic::NumpyVectorT<nupic::UInt32> inds(py_inds);
    self->normalizeBlockByRows(inds.begin(), inds.end(), val, eps_n);
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__normalizeBlockByRows_binary(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,PyObject *py_inds,nupic::Real32 val=-1.0,nupic::Real32 eps_n=1e-6){
    nupic::NumpyVectorT<nupic::UInt32> inds(py_inds);
    self->normalizeBlockByRows_binary(inds.begin(), inds.end(), val, eps_n);
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__axby__SWIG_2(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,nupic::UInt32 row,nupic::Real32 a,nupic::Real32 b,PyObject *xIn){
    PyArrayObject* x = (PyArrayObject*) xIn;
    nupic::Real32* x_begin = (nupic::Real32*)(x->data);
    self->axby(row, a, b, x_begin);
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__axby__SWIG_3(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,nupic::Real32 a,nupic::Real32 b,PyObject *xIn){
    PyArrayObject* x = (PyArrayObject*) xIn;
    nupic::Real32* x_begin = (nupic::Real32*)(x->data);
    self->axby(a, b, x_begin);
  }
SWIGINTERN nupic::Real32 nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rightVecProd__SWIG_5(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,nupic::UInt32 row,PyObject *xIn){
    nupic::NumpyVectorT<nupic::Real32> x(xIn);
    return self->rightVecProd(row, x.begin());
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rightVecProd__SWIG_6(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,PyObject *xIn){
    nupic::NumpyVectorT<nupic::Real32> x(xIn);
    nupic::NumpyVectorT<nupic::Real32> y(self->nRows());
    self->rightVecProd(x.begin(), y.begin());
    return y.forPython();
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rightVecProd_fast(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,PyObject *xIn,PyObject *yOut){
    PyArrayObject* x = (PyArrayObject*) xIn;
    nupic::Real32* x_begin = (nupic::Real32*)(x->data);
    PyArrayObject* y = (PyArrayObject*) yOut;
    nupic::Real32* y_begin = (nupic::Real32*)(y->data);
    self->rightVecProd(x_begin, y_begin);
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rightVecProd__SWIG_7(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,PyObject *pyRows,PyObject *xIn){
    nupic::NumpyVectorT<nupic::Real32> x(xIn);
    nupic::NumpyVectorT<nupic::UInt32> rows(pyRows);
    nupic::NumpyVectorT<nupic::Real32> y(rows.size());
    self->rightVecProd(rows.begin(), rows.end(), x.begin(), y.begin());
    return y.forPython();
  }
SWIGINTERN nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__blockRightVecProd(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,nupic::UInt32 block_size,PyObject *xIn){
    nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > > result;
    nupic::NumpyVectorT<nupic::Real32> x(xIn);
    self->blockRightVecProd(block_size, x.begin(), result);
    return result;
  }
SWIGINTERN nupic::Real32 nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__leftVecProd__SWIG_5(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,nupic::UInt32 col,PyObject *xIn){
    nupic::NumpyVectorT<nupic::Real32> x(xIn);
    return self->leftVecProd(col, x.begin());
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__leftVecProd__SWIG_6(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,PyObject *xIn){
    nupic::NumpyVectorT<nupic::Real32> x(xIn);
    nupic::NumpyVectorT<nupic::Real32> y(self->nCols());
    self->leftVecProd(x.begin(), y.begin());
    return y.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__leftVecProd__SWIG_7(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,PyObject *pyCols,PyObject *xIn){
    nupic::NumpyVectorT<nupic::UInt32> cols(pyCols);
    nupic::NumpyVectorT<nupic::Real32> x(xIn), y(cols.size());
    self->leftVecProd(cols.begin(), cols.end(), x.begin(), y.begin());
    return y.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__leftVecProd_binary(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,PyObject *pyCols,PyObject *xIn){
    nupic::NumpyVectorT<nupic::UInt32> cols(pyCols);
    nupic::NumpyVectorT<nupic::Real32> x(xIn), y(cols.size());
    self->leftVecProd_binary(cols.begin(), cols.end(), x.begin(), y.begin());
    return y.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rightDenseMatProd(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,PyObject *mIn){
    nupic::NumpyMatrixT<nupic::Real32> m(mIn);
    int nRowsCols[2];
    nRowsCols[0] = self->nRows();
    nRowsCols[1] = m.nCols();
    nupic::NumpyMatrixT<nupic::Real32> r(nRowsCols);
    self->rightDenseMatProd(m,r);
    return r.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rightDenseMatProdAtNZ(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,PyObject *mIn){
    nupic::NumpyMatrixT<nupic::Real32> m(mIn);
    int nRowsCols[2];
    nRowsCols[0] = self->nRows();
    nRowsCols[1] = m.nCols();
    nupic::NumpyMatrixT<nupic::Real32> r(nRowsCols);
    self->rightDenseMatProdAtNZ(m,r);
    return r.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__denseMatExtract(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,PyObject *mIn){
    nupic::NumpyMatrixT<nupic::Real32> m(mIn);
    int nRowsCols[2];
    nRowsCols[0] = self->nRows();
    nRowsCols[1] = m.nCols();
    nupic::NumpyMatrixT<nupic::Real32> r(nRowsCols);
    self->denseMatExtract(m,r);
    return r.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__leftDenseMatProd(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,PyObject *mIn){
    nupic::NumpyMatrixT<nupic::Real32> m(mIn);
    int nRowsCols[2];
    nRowsCols[0] = m.nRows();
    nRowsCols[1] = self->nCols();
    nupic::NumpyMatrixT<nupic::Real32> r(nRowsCols);
    for (int i = 0; i != m.nRows(); ++i)
      self->leftVecProd(m.begin(i), r.begin(i));
    return r.forPython();
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__elementRowAdd(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,nupic::UInt32 i,PyObject *xIn){
    nupic::NumpyVectorT<nupic::Real32> x(xIn);
    self->elementRowAdd(i, x.begin());
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__elementRowSubtract(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,nupic::UInt32 i,PyObject *xIn){
    nupic::NumpyVectorT<nupic::Real32> x(xIn);
    self->elementRowSubtract(i, x.begin());
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__elementRowMultiply__SWIG_4(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,nupic::UInt32 i,PyObject *xIn){
    nupic::NumpyVectorT<nupic::Real32> x(xIn);
    self->elementRowMultiply(i, x.begin());
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__elementRowDivide__SWIG_2(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,nupic::UInt32 i,PyObject *xIn){
    nupic::NumpyVectorT<nupic::Real32> x(xIn);
    self->elementRowDivide(i, x.begin());
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__elementColAdd(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,nupic::UInt32 i,PyObject *xIn){
    nupic::NumpyVectorT<nupic::Real32> x(xIn);
    self->elementColAdd(i, x.begin());
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__elementColSubtract(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,nupic::UInt32 i,PyObject *xIn){
    nupic::NumpyVectorT<nupic::Real32> x(xIn);
    self->elementColSubtract(i, x.begin());
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__elementColMultiply__SWIG_4(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,nupic::UInt32 i,PyObject *xIn){
    nupic::NumpyVectorT<nupic::Real32> x(xIn);
    self->elementColMultiply(i, x.begin());
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__elementColDivide__SWIG_2(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,nupic::UInt32 i,PyObject *xIn){
    nupic::NumpyVectorT<nupic::Real32> x(xIn);
    self->elementColDivide(i, x.begin());
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__elementMultiply__SWIG_4(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,PyObject *mIn){
    nupic::NumpyMatrixT<nupic::Real32> m(mIn);
    self->elementMultiply(m.begin(0));
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rightVecProdAtNZ(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,PyObject *xIn){
    nupic::NumpyVectorT<nupic::Real32> x(xIn), y(self->nRows());
    self->rightVecProdAtNZ(x.begin(), y.begin());
    return y.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__leftVecProdAtNZ(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,PyObject *xIn){
    nupic::NumpyVectorT<nupic::Real32> x(xIn), y(self->nCols());
    self->leftVecProdAtNZ(x.begin(), y.begin());
    return y.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rightVecSumAtNZ(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,PyObject *xIn){
    nupic::NumpyVectorT<nupic::Real32> x(xIn);
    nupic::NumpyVectorT<nupic::Real32> y(self->nRows());
    self->rightVecSumAtNZ(x.begin(), y.begin());
    return y.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rightVecSumAtNZGtThreshold(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,PyObject *xIn,nupic::Real32 threshold){
    nupic::NumpyVectorT<nupic::Real32> x(xIn);
    nupic::NumpyVectorT<nupic::Real32> y(self->nRows());
    self->rightVecSumAtNZGtThreshold(x.begin(), y.begin(), threshold);
    return y.forPython();
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rightVecSumAtNZ_fast(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,PyObject *xIn,PyObject *yOut){
    PyArrayObject* x = (PyArrayObject*) xIn;
    nupic::Real32* x_begin = (nupic::Real32*)(x->data);
    PyArrayObject* y = (PyArrayObject*) yOut;
    nupic::Real32* y_begin = (nupic::Real32*)(y->data);
    self->rightVecSumAtNZ(x_begin, y_begin);
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__leftVecSumAtNZ(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,PyObject *xIn){
    nupic::NumpyVectorT<nupic::Real32> x(xIn);
    nupic::NumpyVectorT<nupic::Real32> y(self->nCols());
    self->leftVecSumAtNZ(x.begin(), y.begin());
    return y.forPython();
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__leftVecSumAtNZ_fast(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,PyObject *xIn,PyObject *yOut){
    PyArrayObject* x = (PyArrayObject*) xIn;
    nupic::Real32* x_begin = (nupic::Real32*)(x->data);
    PyArrayObject* y = (PyArrayObject*) yOut;
    nupic::Real32* y_begin = (nupic::Real32*)(y->data);
    self->leftVecSumAtNZ(x_begin, y_begin);
  }
SWIGINTERN void nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rightVecSumAtNZGtThreshold_fast(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,PyObject *xIn,PyObject *yOut,nupic::Real32 threshold){
    PyArrayObject* x = (PyArrayObject*) xIn;
    nupic::Real32* x_begin = (nupic::Real32*)(x->data);
    PyArrayObject* y = (PyArrayObject*) yOut;
    nupic::Real32* y_begin = (nupic::Real32*)(y->data);
    self->rightVecSumAtNZGtThreshold(x_begin, y_begin, threshold);
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__leftDenseMatProdAtNZ(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,PyObject *mIn){
    nupic::NumpyMatrixT<nupic::Real32> m(mIn);
    int nRowsCols[2];
    nRowsCols[0] = m.nRows();
    nRowsCols[1] = self->nCols();
    nupic::NumpyMatrixT<nupic::Real32> r(nRowsCols);
    for (int i = 0; i != m.nRows(); ++i)
      self->leftVecProdAtNZ(m.begin(i), r.begin(i));
    return r.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rightDenseMatSumAtNZ(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,PyObject *mIn){
    nupic::NumpyMatrixT<nupic::Real32> m(mIn);
    int nRowsCols[2];
    nRowsCols[0] = m.nRows();
    nRowsCols[1] = self->nRows();
    nupic::NumpyMatrixT<nupic::Real32> r(nRowsCols);
    for (int i = 0; i != m.nRows(); ++i)
      self->rightVecSumAtNZ(m.begin(i), r.begin(i));
    return r.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__leftDenseMatSumAtNZ(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,PyObject *mIn){
    nupic::NumpyMatrixT<nupic::Real32> m(mIn);
    int nRowsCols[2];
    nRowsCols[0] = m.nRows();
    nRowsCols[1] = self->nCols();
    nupic::NumpyMatrixT<nupic::Real32> r(nRowsCols);
    for (int i = 0; i != m.nRows(); ++i)
      self->leftVecSumAtNZ(m.begin(i), r.begin(i));
    return r.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rightDenseMatMaxAtNZ(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,PyObject *mIn){
    nupic::NumpyMatrixT<nupic::Real32> m(mIn);
    int nRowsCols[2];
    nRowsCols[0] = m.nRows();
    nRowsCols[1] = self->nRows();
    nupic::NumpyMatrixT<nupic::Real32> r(nRowsCols);
    for (int i = 0; i != m.nRows(); ++i)
      self->rightVecMaxAtNZ(m.begin(i), r.begin(i));
    return r.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__leftDenseMatMaxAtNZ(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,PyObject *mIn){
    nupic::NumpyMatrixT<nupic::Real32> m(mIn);
    int nRowsCols[2];
    nRowsCols[0] = m.nRows();
    nRowsCols[1] = self->nCols();
    nupic::NumpyMatrixT<nupic::Real32> r(nRowsCols);
    for (int i = 0; i != m.nRows(); ++i)
      self->leftVecMaxAtNZ(m.begin(i), r.begin(i));
    return r.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__vecArgMaxAtNZ(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,PyObject *xIn){
    nupic::NumpyVectorT<nupic::Real32> x(xIn);
    nupic::NumpyVectorT<nupic::UInt32> y(self->nRows());
    self->vecArgMaxAtNZ(x.begin(), y.begin());
    return y.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__vecMaxAtNZ(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,PyObject *xIn){
    nupic::NumpyVectorT<nupic::Real32> x(xIn), y(self->nRows());
    self->vecMaxAtNZ(x.begin(), y.begin());
    return y.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rowVecProd(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,PyObject *xIn,nupic::Real32 lb=nupic::Epsilon){
    nupic::NumpyVectorT<nupic::Real32> x(xIn), y(self->nRows());
    self->rowVecProd(x.begin(), y.begin());
    return y.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__vecMaxProd(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,PyObject *xIn){
    nupic::NumpyVectorT<nupic::Real32> x(xIn), y(self->nRows());
    self->vecMaxProd(x.begin(), y.begin());
    return y.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__vecArgMaxProd(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,PyObject *xIn){
    nupic::NumpyVectorT<nupic::Real32> x(xIn);
    nupic::NumpyVectorT<nupic::UInt32> y(self->nRows());
    self->vecArgMaxProd(x.begin(), y.begin());
    return y.forPython();
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__getNonZerosSorted(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,nupic::Int n=-1,bool ascending_values=true){
    typedef nupic::ijv<nupic::UInt32, nupic::Real32> IJV;

    nupic::UInt32 nnz = self->nNonZeros();
    nupic::UInt32 N = n == -1 ? nnz : n;
    std::vector<IJV> ijvs(N);
    if (ascending_values)
      self->getNonZerosSorted(ijvs.begin(), N, IJV::greater_value());
    else
      self->getNonZerosSorted(ijvs.begin(), N, IJV::less_value());
    PyObject* toReturn = PyTuple_New(N);
    for (nupic::UInt32 i = 0; i != N; ++i) {
      PyObject* tuple = 
	nupic::createTriplet32(ijvs[i].i(), ijvs[i].j(), ijvs[i].v());
      PyTuple_SET_ITEM(toReturn, i, tuple);
    }
    return toReturn;
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__threshold__SWIG_2(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,nupic::Real32 threshold,bool getCuts=false){
    if (!getCuts) {
      self->threshold(threshold);
      return NULL;
    } 

    std::vector<nupic::UInt32> cut_i, cut_j;
    std::vector<nupic::Real32> cut_nz;
    nupic::UInt32 c = 0;
    c = self->threshold(threshold, 
			std::back_inserter(cut_i),
			std::back_inserter(cut_j),
			std::back_inserter(cut_nz));
    PyObject* toReturn = PyTuple_New(c);
    for (nupic::UInt32 i = 0; i != c; ++i) {
      PyObject* tuple = nupic::createTriplet32(cut_i[i], cut_j[i], cut_nz[i]);
      PyTuple_SET_ITEM(toReturn, i, tuple);
    }
    return toReturn;
  }
SWIGINTERN PyObject *nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__toPyString(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self){
    SharedPythonOStream py_s(self->CSRSize());
    std::ostream& s = py_s.getStream();
    self->toCSR(s);
    return py_s.close();
  }
SWIGINTERN bool nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__fromPyString(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *self,PyObject *s){
    Py_ssize_t n = 0;
    char *buf = 0;
    int res = PyString_AsStringAndSize(s, &buf, &n); // Reference-neutral.
    if((res == 0) && (n > 0)) {
      std::istringstream s(std::string(buf, n));
      self->fromCSR(s);
      return true;
    }
    else {
      throw std::runtime_error("Failed to read SparseMatrix state from string.");
      return false;
    }
  }
SWIGINTERN bool nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg____eq__(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &other){ return (*self) == other; }
SWIGINTERN bool nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg____ne__(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *self,nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &other){ return (*self) != other; }
SWIGINTERN PyObject *nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg____getstate__(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *self){
    SharedPythonOStream py_s(self->CSRSize());
    std::ostream& s = py_s.getStream();
    self->toCSR(s);
    return py_s.close();
  }
SWIGINTERN void nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__readState(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *self,PyObject *str){
    Py_ssize_t n = 0;
    char *buf = 0;
    int res = PyString_AsStringAndSize(str, &buf, &n); 
    if ((res == 0) && (n > 0)) {
      std::istringstream s(std::string(buf, n));
      self->fromCSR(s);
    } else {
      throw 
	std::runtime_error("Failed to read SparseBinaryMatrix state from string.");
    }
  }
SWIGINTERN void nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__set__SWIG_2(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *self,nupic::UInt32 i,nupic::UInt32 j,nupic::Real32 v){
    self->set(i, j, v);
  }
SWIGINTERN void nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__set__SWIG_3(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *self,nupic::UInt32 row,PyObject *py_indices,nupic::Real32 v){
    nupic::NumpyVectorT<nupic::UInt32> indices(py_indices);
    self->set(row, indices.begin(), indices.end(), v);
  }
SWIGINTERN void nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__setForAllRows(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *self,PyObject *py_indices,nupic::Real32 v){
    nupic::NumpyVectorT<nupic::UInt32> indices(py_indices);
    self->setForAllRows(indices.begin(), indices.end(), v);
  }
SWIGINTERN PyObject *nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__getAllNonZeros(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self,bool two_lists=false){
    const nupic::UInt32 nnz = self->nNonZeros();
    nupic::NumpyVectorT<nupic::UInt32> rows(nnz), cols(nnz);

    self->getAllNonZeros(rows.begin(), cols.begin());

    PyObject* toReturn = NULL;

    if (!two_lists) {
      // Return one list of triples
      toReturn = PyTuple_New(nnz);
      for (nupic::UInt32 i = 0; i != nnz; ++i) {
	PyObject* tuple = PyTuple_New(2);
	PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong(rows.get(i)));
	PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong(cols.get(i)));
	PyTuple_SET_ITEM(toReturn, i, tuple);
      }
    } else {
      // Return two lists
      toReturn = PyTuple_New(2);
      PyTuple_SET_ITEM(toReturn, 0, rows.forPython());
      PyTuple_SET_ITEM(toReturn, 1, cols.forPython());
    }

    return toReturn;
  }
SWIGINTERN void nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__setAllNonZeros(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *self,nupic::UInt32 nrows,nupic::UInt32 ncols,PyObject *py_i,PyObject *py_j,bool sorted=true){
    nupic::NumpyVectorT<nupic::UInt32> i(py_i), j(py_j);
    self->setAllNonZeros(nrows, ncols, i.begin(), i.end(), j.begin(), j.end(), sorted);
  }
SWIGINTERN void nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__setSlice__SWIG_1(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *self,nupic::UInt32 i_begin,nupic::UInt32 j_begin,nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const &other){
    self->setSlice(i_begin, j_begin, other);
  }
SWIGINTERN void nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__setSlice__SWIG_2(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *self,nupic::UInt32 i_begin,nupic::UInt32 j_begin,PyObject *py_other){
    nupic::NumpyMatrixT<nupic::Real32> other(py_other);
    self->setSlice(i_begin, j_begin, other);
  }
SWIGINTERN PyObject *nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__getCol(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self,nupic::UInt32 col){
    const nupic::UInt32 nrows = self->nRows();
    nupic::NumpyVectorT<nupic::UInt32> dense_col(nrows);
    self->getColToDense(col, dense_col.begin(), dense_col.end());
    return dense_col.forPython();
  }
SWIGINTERN PyObject *nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__zeroRowsIndicator(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self){
    nupic::NumpyVectorT<nupic::UInt32> res(self->nRows());
    nupic::UInt32 count = self->zeroRowsIndicator(res.begin(), res.end());
    PyObject *toReturn = PyTuple_New(2);
    PyTuple_SET_ITEM(toReturn, 0, PyInt_FromLong(count));
    PyTuple_SET_ITEM(toReturn, 1, res.forPython());
    return toReturn;
  }
SWIGINTERN PyObject *nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__nonZeroRowsIndicator(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self){
    nupic::NumpyVectorT<nupic::UInt32> res(self->nRows());
    nupic::UInt32 count = self->nonZeroRowsIndicator(res.begin(), res.end());
    PyObject *toReturn = PyTuple_New(2);
    PyTuple_SET_ITEM(toReturn, 0, PyInt_FromLong(count));
    PyTuple_SET_ITEM(toReturn, 1, res.forPython());
    return toReturn;
  }
SWIGINTERN PyObject *nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__nNonZerosPerRow(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self){
    nupic::NumpyVectorT<nupic::UInt32> x(self->nRows());
    self->nNonZerosPerRow(x.begin(), x.end());
    return x.forPython();
  }
SWIGINTERN PyObject *nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__nNonZerosPerCol(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self){
    nupic::NumpyVectorT<nupic::UInt32> x(self->nCols());
    self->nNonZerosPerCol(x.begin(), x.end());
    return x.forPython();
  }
SWIGINTERN nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__nNonZerosPerBox(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self,PyObject *box_i,PyObject *box_j){
      nupic::NumpyVectorT<nupic::UInt32> bounds_i(box_i);
      nupic::NumpyVectorT<nupic::UInt32> bounds_j(box_j);
      nupic::SparseMatrix<nupic::UInt32,nupic::Real32> result(bounds_i.size(), bounds_j.size());
      self->nNonZerosPerBox(bounds_i.begin(), bounds_i.end(),
			    bounds_j.begin(), bounds_j.end(), 
			    result);
      return result;
    }
SWIGINTERN PyObject *nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__rowSums(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self){
    nupic::NumpyVectorT<nupic::UInt32> x(self->nRows());
    self->rowSums(x.begin(), x.end());
    return x.forPython();
  }
SWIGINTERN PyObject *nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__colSums(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self){
    nupic::NumpyVectorT<nupic::UInt32> x(self->nCols());
    self->colSums(x.begin(), x.end());
    return x.forPython();
  }
SWIGINTERN PyObject *nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__overlap(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self,PyObject *py_x){
    nupic::NumpyVectorT<nupic::UInt32> x(py_x);
    nupic::NumpyVectorT<nupic::UInt32> y(self->nRows());
    self->overlap(x.begin(), x.end(), y.begin(), y.end());
    return y.forPython();
  }
SWIGINTERN bool nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__maxAllowedOverlap(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self,nupic::Real32 maxDistance,PyObject *py_x){
    nupic::NumpyVectorT<nupic::UInt32> x(py_x);
    return self->maxAllowedOverlap(maxDistance, x.begin(), x.end());
  }
SWIGINTERN void nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__appendSparseRow(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *self,PyObject *py_x){
    nupic::NumpyVectorT<nupic::UInt32> x(py_x);
    self->appendSparseRow(x.begin(), x.end());
  }
SWIGINTERN void nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__appendDenseRow(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *self,PyObject *py_x){
    nupic::NumpyVectorT<nupic::Real32> x(py_x);
    self->appendDenseRow(x.begin(), x.end());
  }
SWIGINTERN void nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__replaceSparseRow(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *self,nupic::UInt32 row,PyObject *py_x){
    nupic::NumpyVectorT<nupic::UInt32> x(py_x);
    self->replaceSparseRow(row, x.begin(), x.end());
  }
SWIGINTERN void nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__appendSparseCol(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *self,PyObject *py_x){
    nupic::NumpyVectorT<nupic::UInt32> x(py_x);
    self->appendSparseCol(x.begin(), x.end());
  }
SWIGINTERN PyObject *nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__getRowSparse(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self,nupic::UInt32 row){
    nupic::NumpyVectorT<nupic::UInt32> x(self->nNonZerosOnRow(row));
    const nupic::SparseBinaryMatrix<nupic::UInt32>::Row& _row =
      self->getSparseRow(row);
    for (nupic::UInt32 i = 0; i != _row.size(); ++i)
      x.set(i, _row[i]);
    return x.forPython();
  }
SWIGINTERN nupic::UInt32 nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__findRowSparse(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self,PyObject *py_x){
    nupic::NumpyVectorT<nupic::UInt32> x(py_x);
    return self->findRowSparse(x.begin(), x.end());
  }
SWIGINTERN nupic::UInt32 nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__findRowDense(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self,PyObject *py_x){
    nupic::NumpyVectorT<nupic::UInt32> x(py_x);
    return self->findRowDense(x.begin(), x.end());
  }
SWIGINTERN void nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__fromDense(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *self,PyObject *py_m){
    nupic::NumpyMatrixT<nupic::UInt32> m(py_m);
    self->fromDense(m.rows(), m.columns(), 
		    m.addressOf(0,0), m.addressOf(0,0) + m.rows() * m.columns());
  }
SWIGINTERN PyObject *nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__toDense(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self){
    int dims[] = { static_cast<int>(self->nRows()), static_cast<int>(self->nCols()) };
    nupic::NumpyMatrixT<nupic::UInt32> out(dims);
    self->toDense(out.addressOf(0, 0), out.addressOf(0, 0) + dims[0] * dims[1]);
    return out.forPython();
  }
SWIGINTERN PyObject *nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__toCSR__SWIG_1(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self){
    std::ostringstream s;
    self->toCSR(s);
    std::string str = s.str();
    return PyString_FromStringAndSize(str.data(), str.size());
  }
SWIGINTERN void nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__fromCSR__SWIG_1(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *self,PyObject *str){
    Py_ssize_t n = 0;
    char *buf = 0;
    int res = PyString_AsStringAndSize(str, &buf, &n); // Reference-neutral.
    if ((res == 0) && (n > 0)) {
      std::istringstream s(std::string(buf, n));
      self->fromCSR(s);
    } else {
      throw std::runtime_error("Failed to read SparseBinaryMatrix state from string.");
    }
  }
SWIGINTERN PyObject *nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__toPyString(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self){
    SharedPythonOStream py_s(self->CSRSize());
    std::ostream& s = py_s.getStream();
    self->toCSR(s);
    return py_s.close();
  }
SWIGINTERN bool nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__fromPyString(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *self,PyObject *s){
    Py_ssize_t n = 0;
    char *buf = 0;
    int res = PyString_AsStringAndSize(s, &buf, &n); // Reference-neutral.
    if((res == 0) && (n > 0)) {
      std::istringstream s(std::string(buf, n));
      self->fromCSR(s);
      return true;
    }
    else {
      throw std::runtime_error("Failed to read SparseBinaryMatrix state from string.");
      return false;
    }
  }
SWIGINTERN void nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__CSRSaveToFile(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self,std::string const &filename){
    std::ofstream save_file(filename.c_str());
    self->toCSR(save_file);
    save_file.close();
  }
SWIGINTERN void nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__CSRLoadFromFile(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *self,std::string const &filename){
    std::ifstream load_file(filename.c_str());
    self->fromCSR(load_file);
    load_file.close();
  }
SWIGINTERN void nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__binarySaveToFile(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self,std::string const &filename){
    std::ofstream save_file(filename.c_str());
    self->toBinary(save_file);
    save_file.close();
  }
SWIGINTERN void nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__binaryLoadFromFile(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *self,std::string const &filename){
    std::ifstream load_file(filename.c_str());
    self->fromBinary(load_file);
    load_file.close();
  }
SWIGINTERN void nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__write__SWIG_1(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self,PyObject *pyBuilder){
    SparseBinaryMatrixProto::Builder proto =
        nupic::getBuilder<SparseBinaryMatrixProto>(pyBuilder);
    self->write(proto);
  }
SWIGINTERN void nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__read__SWIG_1(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *self,PyObject *pyReader){
    SparseBinaryMatrixProto::Reader proto =
        nupic::getReader<SparseBinaryMatrixProto>(pyReader);
    self->read(proto);
  }
SWIGINTERN void nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__fromSparseVector(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *self,nupic::UInt32 nrows,nupic::UInt32 ncols,PyObject *py_x,nupic::UInt32 offset=0){
    nupic::NumpyVectorT<nupic::UInt32> x(py_x);
    self->fromSparseVector(nrows, ncols, x.begin(), x.end(), offset);
  }
SWIGINTERN PyObject *nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__toSparseVector(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *self,nupic::UInt32 offset=0){
    nupic::NumpyVectorT<nupic::UInt32> x(self->nNonZeros());
    self->toSparseVector(x.begin(), x.end(), offset);
    return x.forPython();
  }
SWIGINTERN PyObject *nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__getRow(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self,nupic::UInt32 row){
    nupic::NumpyVectorT<nupic::Real32> x(self->nCols());
    self->getRow(row, x.begin(), x.end());
    return x.forPython();
  }
SWIGINTERN void nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__rowFromDense(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *self,nupic::UInt32 row,PyObject *py_x){
    nupic::NumpyVectorT<nupic::Real32> x(py_x);
    self->rowFromDense(row, x.begin(), x.end());
  }
SWIGINTERN PyObject *nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__rowToDense(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self,nupic::UInt32 row){
    nupic::NumpyVectorT<nupic::Real32> x(self->nCols());
    self->rowToDense(row, x.begin(), x.end());
    return x.forPython();
  }
SWIGINTERN PyObject *nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__rightVecSumAtNZ(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self,PyObject *py_x){
    PyArrayObject* x = (PyArrayObject*) py_x;
    nupic::Real32* x_begin = (nupic::Real32*)(x->data);
    nupic::Real32* x_end = x_begin + x->dimensions[0];
    nupic::NumpyVectorT<nupic::Real32> y(self->nRows());
    self->rightVecSumAtNZ(x_begin, x_end, y.begin(), y.end());
    return y.forPython();
  }
SWIGINTERN void nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__rightVecSumAtNZ_fast(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self,PyObject *py_x,PyObject *py_y){
    PyArrayObject* x = (PyArrayObject*) py_x;
    nupic::Real32* x_begin = (nupic::Real32*)(x->data);
    nupic::Real32* x_end = x_begin + x->dimensions[0];
    PyArrayObject* y = (PyArrayObject*) py_y;
    nupic::Real32* y_begin = (nupic::Real32*)(y->data);
    nupic::Real32* y_end = y_begin + y->dimensions[0];
    self->rightVecSumAtNZ(x_begin, x_end, y_begin, y_end);
  }
SWIGINTERN PyObject *nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__leftVecSumAtNZ(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self,PyObject *py_x){
    PyArrayObject* x = (PyArrayObject*) py_x;
    nupic::Real32* x_begin = (nupic::Real32*)(x->data);
    nupic::Real32* x_end = x_begin + x->dimensions[0];
    nupic::NumpyVectorT<nupic::Real32> y(self->nCols());
    self->leftVecSumAtNZ(x_begin, x_end, y.begin(), y.end());
    return y.forPython();
  }
SWIGINTERN void nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__leftVecSumAtNZ_fast(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self,PyObject *py_x,PyObject *py_y){
    PyArrayObject* x = (PyArrayObject*) py_x;
    nupic::Real32* x_begin = (nupic::Real32*)(x->data);
    nupic::Real32* x_end = x_begin + x->dimensions[0];
    PyArrayObject* y = (PyArrayObject*) py_y;
    nupic::Real32* y_begin = (nupic::Real32*)(y->data);
    nupic::Real32* y_end = y_begin + y->dimensions[0];
    self->leftVecSumAtNZ(x_begin, x_end, y_begin, y_end);
  }
SWIGINTERN PyObject *nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__rightDenseMatMaxAtNZ(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self,PyObject *mIn){
    nupic::NumpyMatrixT<nupic::Real32> m(mIn);
    int nRowsCols[2];
    nRowsCols[0] = m.nRows();
    nRowsCols[1] = self->nRows();
    nupic::NumpyMatrixT<nupic::Real32> r(nRowsCols);
    for (int i = 0; i != m.nRows(); ++i)
      self->rightVecMaxAtNZ(m.begin(i), r.begin(i));
    return r.forPython();
  }
SWIGINTERN PyObject *nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__leftDenseMatSumAtNZ(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self,PyObject *mIn){
    nupic::NumpyMatrixT<nupic::Real32> m(mIn);
    int nRowsCols[2];
    nRowsCols[0] = m.nRows();
    nRowsCols[1] = self->nCols();
    nupic::NumpyMatrixT<nupic::Real32> r(nRowsCols);
    for (int i = 0; i != m.nRows(); ++i)
      self->leftVecSumAtNZ(m.begin(i), m.end(i), r.begin(i), r.end(i));
    return r.forPython();
  }
SWIGINTERN PyObject *nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__leftDenseMatMaxAtNZ(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self,PyObject *mIn){
    nupic::NumpyMatrixT<nupic::Real32> m(mIn);
    int nRowsCols[2];
    nRowsCols[0] = m.nRows();
    nRowsCols[1] = self->nCols();
    nupic::NumpyMatrixT<nupic::Real32> r(nRowsCols);
    for (int i = 0; i != m.nRows(); ++i)
      self->leftVecMaxAtNZ(m.begin(i), r.begin(i));
    return r.forPython();
  }
SWIGINTERN PyObject *nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__minHammingDistance(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self,PyObject *py_x){
    nupic::NumpyVectorT<nupic::UInt32> x(py_x);
    std::pair<nupic::UInt32, nupic::UInt32> r =
      self->minHammingDistance(x.begin(), x.end());
    PyObject *toReturn = PyTuple_New(2);
    PyTuple_SET_ITEM(toReturn, 0, PyInt_FromLong(r.first));
    PyTuple_SET_ITEM(toReturn, 1, PyInt_FromLong(r.second));
    return toReturn;
  }
SWIGINTERN PyObject *nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__firstRowCloserThan(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self,PyObject *py_x,nupic::UInt32 distance){
    nupic::NumpyVectorT<nupic::UInt32> x(py_x);
    nupic::UInt32 i = self->firstRowCloserThan(x.begin(), x.end(), distance);
    return PyInt_FromLong(i);
  }
SWIGINTERN PyObject *nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__firstRowCloserThan_dense(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self,PyObject *py_x,nupic::UInt32 distance){
    nupic::NumpyVectorT<nupic::UInt32> x(py_x);
    nupic::UInt32 i = self->firstRowCloserThan_dense(x.begin(), x.end(), distance);
    return PyInt_FromLong(i);
  }
SWIGINTERN PyObject *nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__vecMaxProd(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self,PyObject *py_x){
    nupic::NumpyVectorT<nupic::Real32> x(py_x), y(self->nRows());
    self->vecMaxProd(x.begin(), x.end(), y.begin(), y.end());
    return y.forPython();
  }
SWIGINTERN PyObject *nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__rightVecArgMaxAtNZ(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self,PyObject *py_x){
    nupic::NumpyVectorT<nupic::Real32> x(py_x), y(self->nRows());
    self->rightVecArgMaxAtNZ(x.begin(), y.begin());
    return y.forPython();
  }
SWIGINTERN bool nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg____eq__(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self,nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const &other){ 
    return self->equals(other); 
  }
SWIGINTERN bool nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg____ne__(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *self,nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const &other){ 
    return ! self->equals(other); 
  }


  /*
void _copyFrom__SparseMatrix64(
    const nupic::SparseMatrix<nupic::UInt32,nupic::Real64,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real64 > > &input,
    nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > > &output
  )
{
  output.copy(input);
}

void _copyFrom__SparseMatrix32(
    const nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > > &input,
    nupic::SparseMatrix<nupic::UInt32,nupic::Real64,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real64 > > &output
  )
{
  output.copy(input);
}

void aX_plus_bX_elementMultiply_Y(
    double a,
    nupic::SparseMatrix<nupic::UInt32,nupic::Real64,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real64 > > &X,
    double b,
    const nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > > &Y
  )
{
  nupic::SparseMatrixAlgorithms::aX_plus_bX_elementMultiply_Y(a, X, b, Y);
}

void aX_plus_bX_elementMultiply_Y(
    double a,
    nupic::SparseMatrix<nupic::UInt32,nupic::Real64,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real64 > > &X,
    double b,
    const nupic::SparseMatrix<nupic::UInt32,nupic::Real64,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real64 > > &Y
  )
{
  nupic::SparseMatrixAlgorithms::aX_plus_bX_elementMultiply_Y(a, X, b, Y);
}
  */

PyObject* 
kthroot_product(const nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > > & sm, nupic::UInt32 segment_size, PyObject* xIn, nupic::Real32 threshold)
{
  nupic::NumpyVectorT<nupic::Real32> x(xIn), y(sm.nRows());
  nupic::SparseMatrixAlgorithms::kthroot_product(sm, segment_size, x.begin(), y.begin(), threshold);
  return y.forPython();
}

/*
PyObject* 
kthroot_product(const nupic::SparseMatrix<nupic::UInt32,nupic::Real64,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real64 > > & sm, nupic::UInt32 segment_size, PyObject* xIn, nupic::Real64 threshold)
{
  nupic::NumpyVectorT<nupic::Real64> x(xIn), y(sm.nRows());
  nupic::SparseMatrixAlgorithms::kthroot_product(sm, segment_size, x.begin(), y.begin(), threshold);
  return y.forPython();
}

PyObject* sparseRightVecProd(const nupic::SparseMatrix<nupic::UInt32,nupic::Real64,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real64 > >& a,
                             nupic::UInt32 m, nupic::UInt32 n,
                             PyObject* x)
{
  nupic::NumpyVectorT<nupic::Real64> xx(x), yy(a.nRows());
  nupic::SparseMatrixAlgorithms::sparseRightVecProd(a, m, n, xx.begin(), yy.begin());
  return yy.forPython();
}
*/

PyObject* sparseRightVecProd(const nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > >& a,
                             nupic::UInt32 m, nupic::UInt32 n,
                             PyObject* x)
{
  nupic::NumpyVectorT<nupic::Real32> xx(x), yy(a.nRows());
  nupic::SparseMatrixAlgorithms::sparseRightVecProd(a, m, n, xx.begin(), yy.begin());
  return yy.forPython();
}

//--------------------------------------------------------------------------------
// A function that decide if a binary 0/1 vector is all zeros, or not.
//--------------------------------------------------------------------------------
inline bool isZero_01(PyObject* py_x)
{
  PyArrayObject* x = (PyArrayObject*) py_x;
  nupic::Real32* begin = (nupic::Real32*)(x->data);
  nupic::Real32* end = begin + x->dimensions[0];
  return nupic::isZero_01(begin, end);
}

//--------------------------------------------------------------------------------
// A function that sums the elements in a dense range, faster than numpy and C++.
// Uses SIMD instructions in asm.
//--------------------------------------------------------------------------------
inline nupic::Real32 dense_vector_sum(PyObject* py_x)
{
  PyArrayObject* x = (PyArrayObject*) py_x;
  nupic::Real32* begin = (nupic::Real32*)(x->data);
  nupic::Real32* end = begin + x->dimensions[0];
  return nupic::sum(begin, end);
}

//--------------------------------------------------------------------------------
// A function that binarizes a dense vector.
//--------------------------------------------------------------------------------
inline PyObject* binarize_with_threshold(nupic::Real32 threshold, PyObject* py_x)
{
  PyArrayObject* x = (PyArrayObject*) py_x;
  nupic::Real32* begin = (nupic::Real32*)(x->data);
  nupic::Real32* end = begin + x->dimensions[0];
  nupic::NumpyVectorT<nupic::Real32> y(end - begin);
  nupic::UInt32 c =
    nupic::binarize_with_threshold(threshold, begin, end, y.begin(), y.end());
  PyObject* toReturn = PyTuple_New(2);
  PyTuple_SET_ITEM(toReturn, 0, PyInt_FromLong(c));
  PyTuple_SET_ITEM(toReturn, 1, y.forPython());
  return toReturn;
}

//--------------------------------------------------------------------------------
// Functions on 2D dense arrays of 0/1
//--------------------------------------------------------------------------------
inline PyObject* 
nonZeroRowsIndicator_01(nupic::UInt32 nrows, nupic::UInt32 ncols, PyObject* py_x)
{
  PyArrayObject* x = (PyArrayObject*) py_x;
  nupic::Real32* begin = (nupic::Real32*)(x->data);
  nupic::Real32* end = begin + x->dimensions[0];
  nupic::NumpyVectorT<nupic::UInt32> ind(nrows);
  nupic::nonZeroRowsIndicator_01(nrows, ncols, begin, end, ind.begin(), ind.end());
  return ind.forPython();
}

inline PyObject* 
nonZeroColsIndicator_01(nupic::UInt32 nrows, nupic::UInt32 ncols, PyObject* py_x)
{
  PyArrayObject* x = (PyArrayObject*) py_x;
  nupic::Real32* begin = (nupic::Real32*)(x->data);
  nupic::Real32* end = begin + x->dimensions[0];
  nupic::NumpyVectorT<nupic::UInt32> ind(ncols);
  nupic::nonZeroColsIndicator_01(nrows, ncols, begin, end, ind.begin(), ind.end());
  return ind.forPython();
}

inline nupic::UInt32 nNonZeroRows_01(nupic::UInt32 nrows, nupic::UInt32 ncols, PyObject* py_x)
{
  PyArrayObject* x = (PyArrayObject*) py_x;
  nupic::Real32* begin = (nupic::Real32*)(x->data);
  nupic::Real32* end = begin + x->dimensions[0];
  return nupic::nNonZeroRows_01(nrows, ncols, begin, end);
}

inline nupic::UInt32 nNonZeroCols_01(nupic::UInt32 nrows, nupic::UInt32 ncols, PyObject* py_x)
{
  PyArrayObject* x = (PyArrayObject*) py_x;
  nupic::Real32* begin = (nupic::Real32*)(x->data);
  nupic::Real32* end = begin + x->dimensions[0];
  return nupic::nNonZeroCols_01(nrows, ncols, begin, end);
}

//--------------------------------------------------------------------------------



  //--------------------------------------------------------------------------------
  PyObject* matrix_entropy(const nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > >& sm, nupic::Real32 s =1.0)
  {
    nupic::NumpyVectorT<nupic::Real32> e_rows(sm.nRows()), e_cols(sm.nCols());
    nupic::SparseMatrixAlgorithms::matrix_entropy(sm,
						e_rows.begin(), e_rows.end(),
						e_cols.begin(), e_cols.end(),
						s);
    PyObject *toReturn = PyTuple_New(2);
    PyTuple_SET_ITEM(toReturn, 0, e_rows.forPython());
    PyTuple_SET_ITEM(toReturn, 1, e_cols.forPython());
    return toReturn;
  }

  //--------------------------------------------------------------------------------
  /*
  PyObject* matrix_entropy(const nupic::SparseMatrix<nupic::UInt32,nupic::Real64,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real64 > >& sm, nupic::Real64 s =1.0)
  {
    nupic::NumpyVectorT<nupic::Real64> e_rows(sm.nRows()), e_cols(sm.nCols());
    nupic::SparseMatrixAlgorithms::matrix_entropy(sm,
						e_rows.begin(), e_rows.end(),
						e_cols.begin(), e_cols.end(),
						s);
    PyObject *toReturn = PyTuple_New(2);
    PyTuple_SET_ITEM(toReturn, 0, e_rows.forPython());
    PyTuple_SET_ITEM(toReturn, 1, e_cols.forPython());
    return toReturn;
  }
  */

  //--------------------------------------------------------------------------------
  PyObject* smoothVecMaxProd(const nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > >& sm, nupic::Real32 k, PyObject *xIn)
  {
    nupic::NumpyVectorT<nupic::Real32> x(xIn), y(sm.nRows());
    nupic::SparseMatrixAlgorithms::smoothVecMaxProd(sm, k, x.begin(), x.end(), y.begin(), y.end());
    return y.forPython();
  }

  //--------------------------------------------------------------------------------
  PyObject* smoothVecArgMaxProd(const nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > >& sm, nupic::Real32 k, PyObject *xIn)
  {
    nupic::NumpyVectorT<nupic::Real32> x(xIn);
    nupic::NumpyVectorT<nupic::UInt32> y(sm.nRows());
    nupic::SparseMatrixAlgorithms::smoothVecArgMaxProd(sm, k, x.begin(), x.end(), y.begin(), y.end());
    return y.forPython();
  }
  
  //--------------------------------------------------------------------------------
  // LBP
  //--------------------------------------------------------------------------------
  void LBP_piPrime(nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > >& mat, nupic::Real32 min_floor =0)
  {
    nupic::SparseMatrixAlgorithms::LBP_piPrime(mat, min_floor);
  }

  //--------------------------------------------------------------------------------
  /*
  void LBP_piPrime(nupic::SparseMatrix<nupic::UInt32,nupic::Real64,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real64 > >& mat, nupic::Real64 min_floor =0)
  {
    nupic::SparseMatrixAlgorithms::LBP_piPrime(mat, min_floor);
  }
  */

  //--------------------------------------------------------------------------------
  void SM_subtractNoAlloc(nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > >& A,
			  const nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > >& B, double min_floor =0)
  {
    nupic::SparseMatrixAlgorithms::subtractNoAlloc(A, B, min_floor);
  }

  //--------------------------------------------------------------------------------
  /*
  void SM_subtractNoAlloc(nupic::SparseMatrix<nupic::UInt32,nupic::Real64,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real64 > >& A,
			  nupic::SparseMatrix<nupic::UInt32,nupic::Real64,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real64 > >& B, double min_floor =0)
  {
    nupic::SparseMatrixAlgorithms::subtractNoAlloc(A, B, min_floor);
  }
  */

  //--------------------------------------------------------------------------------
  void SM_assignNoAlloc(nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > >& A,
		     const nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > >& B)
  {
    nupic::SparseMatrixAlgorithms::assignNoAlloc(A, B);
  }

  //--------------------------------------------------------------------------------
  /*
  void SM_assignNoAlloc(nupic::SparseMatrix<nupic::UInt32,nupic::Real64,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real64 > >& A,
		     nupic::SparseMatrix<nupic::UInt32,nupic::Real64,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real64 > >& B)
  {
    nupic::SparseMatrixAlgorithms::assignNoAlloc(A, B);
  }
  */

  //--------------------------------------------------------------------------------
  void SM_assignNoAllocFromBinary(nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > >& A, const nupic::SparseBinaryMatrix<nupic::UInt32,nupic::UInt32>& B)
  {
    nupic::SparseMatrixAlgorithms::assignNoAllocFromBinary(A, B);
  }

  //--------------------------------------------------------------------------------
  /*
  void SM_assignNoAllocFromBinary(nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > >& A, const nupic::SparseBinaryMatrix<nupic::UInt32,nupic::UInt16>& B)
  {
    nupic::SparseMatrixAlgorithms::assignNoAllocFromBinary(A, B);
  }
  */
	//--------------------------------------------------------------------------------
	void SM_addConstantOnNonZeros(nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > >& A,
								  const nupic::SparseBinaryMatrix<nupic::UInt32,nupic::UInt32>& B,
								  double cval)
	{
		nupic::SparseMatrixAlgorithms::addConstantOnNonZeros(A, B, cval);
	}
	
	//--------------------------------------------------------------------------------
	/*
	 void SM_addConstantOnNonZeros(nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > >& A,
								   const nupic::SparseBinaryMatrix<nupic::UInt32,nupic::UInt32>& B,
								   nupic::Real32 cval)
	 {
	 nupic::SparseMatrixAlgorithms::addConstantOnNonZeros(A, B, cval);
	 }
	 */

  //--------------------------------------------------------------------------------
  void SM_logSumNoAlloc(nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > >& A,
			const nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > >& B, double min_floor =0)
  {
    nupic::SparseMatrixAlgorithms::logSumNoAlloc(A, B, min_floor);
  }

  //--------------------------------------------------------------------------------
  /*
  void SM_logSumNoAlloc(nupic::SparseMatrix<nupic::UInt32,nupic::Real64,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real64 > >& A,
		     nupic::SparseMatrix<nupic::UInt32,nupic::Real64,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real64 > >& B, double min_floor =0)
  {
    nupic::SparseMatrixAlgorithms::logSumNoAlloc(A, B, min_floor);
  }
  */

 //--------------------------------------------------------------------------------
  void SM_logAddValNoAlloc(nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > >& A, double val, double min_floor =0)
  {
    nupic::SparseMatrixAlgorithms::logAddValNoAlloc(A, val, min_floor);
  }

  //--------------------------------------------------------------------------------
  /*
  void SM_logAddValNoAlloc(nupic::SparseMatrix<nupic::UInt32,nupic::Real64,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real64 > >& A, double val, double min_floor =0)
  {
    nupic::SparseMatrixAlgorithms::logAddValNoAlloc(A, val, min_floor);
  }
  */
 
  //--------------------------------------------------------------------------------
  void SM_logDiffNoAlloc(nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > >& A,
		     nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > >& B, double min_floor =0)
  {
    nupic::SparseMatrixAlgorithms::logDiffNoAlloc(A, B, min_floor);
  }

  /*
  //--------------------------------------------------------------------------------
  void SM_logDiffNoAlloc(nupic::SparseMatrix<nupic::UInt32,nupic::Real64,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real64 > >& A,
		     nupic::SparseMatrix<nupic::UInt32,nupic::Real64,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real64 > >& B, double min_floor =0)
  {
    nupic::SparseMatrixAlgorithms::logDiffNoAlloc(A, B, min_floor);
  }
  */

  //--------------------------------------------------------------------------------
  void SM_addToNZOnly(nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > >& A, double v, double min_floor =0)
  {
    nupic::SparseMatrixAlgorithms::addToNZOnly(A, v, min_floor);
  }
  /*
  //--------------------------------------------------------------------------------
  void SM_addToNZOnly(nupic::SparseMatrix<nupic::UInt32,nupic::Real64,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real64 > >& A, double v, double min_floor =0)
  {
    nupic::SparseMatrixAlgorithms::addToNZOnly(A, v, min_floor);
  }
  */

  //--------------------------------------------------------------------------------
  void SM_addToNZDownCols(nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > >& A, PyObject* py_x, double min_floor =0)
  {
    nupic::NumpyVectorT<nupic::Real32> x(py_x);
    nupic::SparseMatrixAlgorithms::addToNZDownCols(A, x.begin(), x.end(), min_floor);
  }

  //--------------------------------------------------------------------------------
  /*
  void SM_addToNZDownCols(nupic::SparseMatrix<nupic::UInt32,nupic::Real64,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real64 > >& A, PyObject* py_x, double min_floor =0)
  {
    nupic::NumpyVectorT<nupic::Real64> x(py_x);
    nupic::SparseMatrixAlgorithms::addToNZDownCols(A, x.begin(), x.end(), min_floor);
  }
  */

  //--------------------------------------------------------------------------------
  void SM_addToNZAcrossRows(nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > >& A, PyObject* py_x, double min_floor =0)
  {
    nupic::NumpyVectorT<nupic::Real32> x(py_x);
    nupic::SparseMatrixAlgorithms::addToNZAcrossRows(A, x.begin(), x.end(), min_floor);
  }

  //--------------------------------------------------------------------------------
  /*
  void SM_addToNZAcrossRows(nupic::SparseMatrix<nupic::UInt32,nupic::Real64,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real64 > >& A, PyObject* py_x, double min_floor =0)
  {
    nupic::NumpyVectorT<nupic::Real64> x(py_x);
    nupic::SparseMatrixAlgorithms::addToNZAcrossRows(A, x.begin(), x.end(), min_floor);
  }
  */


  //--------------------------------------------------------------------------------
  // Count the number of elements greater than the passed in threshold in the given
  // range.
  //--------------------------------------------------------------------------------
  inline nupic::UInt32 count_gt(PyObject* py_x, nupic::Real32 threshold)
  {
    PyArrayObject* x = (PyArrayObject*) py_x;
    nupic::Real32* x_begin = (nupic::Real32*)(x->data);
    nupic::Real32* x_end = x_begin + x->dimensions[0];

    return nupic::count_gt(x_begin, x_end, threshold);
  }

  //--------------------------------------------------------------------------------
  // Count the number of elements greater than or equal to the passed in 
  //  threshold in the given range.
  //--------------------------------------------------------------------------------
  inline nupic::UInt32 count_gte(PyObject* py_x, nupic::Real32 threshold)
  {
    PyArrayObject* x = (PyArrayObject*) py_x;
    nupic::Real32* x_begin = (nupic::Real32*)(x->data);
    nupic::Real32* x_end = x_begin + x->dimensions[0];

    return nupic::count_gte(x_begin, x_end, threshold);
  }

  //--------------------------------------------------------------------------------
  // Count the number of elements less than the passed in threshold in the given
  // range.
  //--------------------------------------------------------------------------------
  inline nupic::UInt32 count_lt(PyObject* py_x, nupic::Real32 threshold)
  {
    PyArrayObject* x = (PyArrayObject*) py_x;
    nupic::Real32* x_begin = (nupic::Real32*)(x->data);
    nupic::Real32* x_end = x_begin + x->dimensions[0];

    return nupic::count_lt(x_begin, x_end, threshold);
  }

  //--------------------------------------------------------------------------------
  // A partial argsort that can use an already allocated buffer to avoid creating 
  // a data structure each time it's called. Assumes that the elements to be sorted
  // are nupic::Real32, or at least that they have the same size.
  //
  // A partial sort is much faster than a full sort. The elements after the k first
  // in the result are not sorted, except that they are greater (or lesser) than
  // all the k first elements. If direction is -1, the sort is in decreasing order.
  // If direction is 1, the sort is in increasing order.
  //
  // The result is returned in the first k positions of the buffer for speed.
  // 
  // Uses a pre-allocated buffer to avoid allocating memory each time a sort
  // is needed.
  //--------------------------------------------------------------------------------
  inline void 
    partialArgsort(size_t k, PyObject* py_x, PyObject* py_r, int direction =-1)
  {
    PyArrayObject* x = (PyArrayObject*) py_x;
    nupic::Real32* x_begin = (nupic::Real32*)(x->data);
    nupic::Real32* x_end = x_begin + x->dimensions[0];

    PyArrayObject* r = (PyArrayObject*) py_r;
    nupic::UInt32* r_begin = (nupic::UInt32*)(r->data);
    nupic::UInt32* r_end = r_begin + r->dimensions[0];

    nupic::partial_argsort(k, x_begin, x_end, r_begin, r_end, direction);
  }

  //--------------------------------------------------------------------------------
  /**
   * Specialized partial argsort with selective random tie breaking, only for the 
   * non-zeros of the original coincidence (passed in which).
   * See partial_argsort_sel_rnd_tie_break for more details.
   */
  inline void 
    positiveLearningPartialArgsort(size_t k, 
                                   PyObject* py_x, PyObject* py_r,
                                   nupic::Random& rng,
                                   bool real_random =false)
  {
    PyArrayObject* x = (PyArrayObject*) py_x;
    nupic::Real32* x_begin = (nupic::Real32*)(x->data);
    nupic::Real32* x_end = x_begin + x->dimensions[0];

    PyArrayObject* r = (PyArrayObject*) py_r;
    nupic::UInt32* r_begin = (nupic::UInt32*)(r->data);
    nupic::UInt32* r_end = r_begin + r->dimensions[0];

    nupic::partial_argsort_rnd_tie_break(k,
                                       x_begin, x_end, 
                                       r_begin, r_end, 
                                       rng, real_random);
  }

  //--------------------------------------------------------------------------------
  // A function to replace numpy logical_and.
  // numpy logical_and doesn't use the SSE, so this asm function is *much* faster.
  //
  // For each corresponding elements of x and y, put the logical and of those two
  // elements at the corresponding position in z.
  //
  // x, y and z are arrays of floats, but with 0/1 values.
  //--------------------------------------------------------------------------------
  inline PyObject* logicalAnd(PyObject* py_x, PyObject* py_y)
  {
    PyArrayObject* x = (PyArrayObject*) py_x;
    nupic::Real32* x_begin = (nupic::Real32*)(x->data);
    nupic::Real32* x_end = x_begin + x->dimensions[0];

    PyArrayObject* y = (PyArrayObject*) py_y;
    nupic::Real32* y_begin = (nupic::Real32*)(y->data);
    nupic::Real32* y_end = y_begin + y->dimensions[0];

    nupic::NumpyVectorT<nupic::Real32> z(x_end - x_begin);

    nupic::logical_and(x_begin, x_end, y_begin, y_end, z.begin(), z.end());

    return z.forPython();
  }

  //--------------------------------------------------------------------------------
  //
  // A version of logicalAnd that puts the result of x && y in y directly.
  // This is supposed to be faster, because z is not allocated as a separate
  // vector: the memory already allocated for y is reused instead.
  //
  //--------------------------------------------------------------------------------
  inline void logicalAnd2(PyObject* py_x, PyObject* py_y)
  {
    PyArrayObject* x = (PyArrayObject*) py_x;
    nupic::Real32* x_begin = (nupic::Real32*)(x->data);
    nupic::Real32* x_end = x_begin + x->dimensions[0];

    PyArrayObject* y = (PyArrayObject*) py_y;
    nupic::Real32* y_begin = (nupic::Real32*)(y->data);
    nupic::Real32* y_end = y_begin + y->dimensions[0];

    nupic::in_place_logical_and(x_begin, x_end, y_begin, y_end);
  }

SWIGINTERN nupic::Real nupic_NearestNeighbor_Sl_nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__Sg__rowDist(nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > const *self,int row,PyObject *xIn){
    nupic::NumpyVectorT<nupic::Real32> x(xIn);
    return self->rowL2Dist(row, x.addressOf(0));
  }
SWIGINTERN PyObject *nupic_NearestNeighbor_Sl_nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__Sg__vecLpDist(nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > const *self,nupic::Real32 p,PyObject *xIn,bool take_root=true){
    nupic::NumpyVectorT<nupic::Real32> x(xIn);
    nupic::NumpyVectorT<nupic::Real32> output(self->nRows());
    self->LpDist(p, x.addressOf(0), output.addressOf(0), take_root);
    return output.forPython();
  }
SWIGINTERN PyObject *nupic_NearestNeighbor_Sl_nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__Sg__LpNearest(nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > const *self,nupic::Real32 p,PyObject *row,nupic::UInt32 k=1,bool take_root=true){
    nupic::NumpyVectorT<nupic::Real32> x(row);
    std::vector<std::pair<nupic::UInt32, nupic::Real32> > nn(k);
    self->LpNearest(p, x.begin(), nn.begin(), k, take_root);
    PyObject* toReturn = PyTuple_New(k);
    for (nupic::UInt32 i = 0; i != k; ++i)
      PyTuple_SET_ITEM(toReturn, i, nupic::createPair32(nn[i].first, nn[i].second));
    return toReturn;
  }
SWIGINTERN PyObject *nupic_NearestNeighbor_Sl_nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__Sg__closestLp_w(nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *self,nupic::Real32 p,PyObject *row){
    nupic::NumpyVectorT<nupic::Real32> x(row);
    std::pair<int, nupic::Real32> nn;
    self->LpNearest_w(p, x.addressOf(0), &nn, true);
    return Py_BuildValue("(if)", nn.first, nn.second);
  }
SWIGINTERN PyObject *nupic_NearestNeighbor_Sl_nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__Sg__closestDot(nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *self,PyObject *row){
    nupic::NumpyVectorT<nupic::Real32> x(row);
    std::pair<int, nupic::Real32> r = self->dotNearest(x.addressOf(0));
    return Py_BuildValue("(if)", r.first, r.second);
  }
SWIGINTERN PyObject *nupic_NearestNeighbor_Sl_nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__Sg__projLpNearest(nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > const *self,nupic::Real32 p,PyObject *py_x,nupic::UInt32 k=1,bool take_root=false){
    nupic::NumpyVectorT<nupic::Real32> x(py_x);
    std::vector<std::pair<nupic::UInt32, nupic::Real32> > nn(k);
    self->projLpNearest(p, x.begin(), nn.begin(), k, take_root);
    PyObject* toReturn = PyTuple_New(k);
    for (nupic::UInt32 i = 0; i != k; ++i)
      PyTuple_SET_ITEM(toReturn, i, nupic::createPair32(nn[i].first, nn[i].second));
    return toReturn;
  }
SWIGINTERN PyObject *nupic_NearestNeighbor_Sl_nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__Sg__projRbf(nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > const *self,nupic::Real32 p,nupic::Real32 k,PyObject *py_x){
    nupic::NumpyVectorT<nupic::Real32> x(py_x), y(self->nRows());
    self->projRbf(p, k, x.begin(), y.begin());
    return y.forPython();
  }

  /*
  //--------------------------------------------------------------------------------
  // PyObject* find_connected_components2(PyObject* g)
  PyObject* find_connected_components2(const nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > > &sm)
      { return _find_connected_components2(sm); }

  PyObject* find_connected_components2(const nupic::SparseMatrix<nupic::UInt32,nupic::Real64,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real64 > > &sm)
      { return _find_connected_components2(sm); }

  //--------------------------------------------------------------------------------
  PyObject* cuthill_mckee(PyObject* g)
  {
    try {
      void* argp1 = SWIG_Python_GetSwigThis(g)->ptr; 
      nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > > *arg1 = reinterpret_cast< nupic::SparseMatrix<nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<nupic::Real32 > > * >(argp1);

      nupic::NumpyVectorT<nupic::UInt32> p(arg1->nRows());
      nupic::NumpyVectorT<nupic::UInt32> rp(arg1->nRows());
      nupic::CuthillMcKeeOrdering(*arg1, p.begin(), rp.begin());
      PyObject* toReturn = PyList_New(2);
      PyList_SET_ITEM(toReturn, 0, p.forPython());
      PyList_SET_ITEM(toReturn, 1, rp.forPython());
      return toReturn;

    } catch(...) {
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>("Unknown error in enumerate_sequences"));
      return NULL;
    }
  }
 */
  //--------------------------------------------------------------------------------
  PyObject* min_score_per_category(nupic::UInt32 maxCategoryIdx, PyObject* c_py,
            PyObject* d_py)
  {
    nupic::NumpyVectorT<nupic::UInt32> c(c_py);
    nupic::NumpyVectorT<nupic::Real32> d(d_py);

    int n = int(maxCategoryIdx + 1);
    nupic::NumpyVectorT<nupic::Real32> s(n, std::numeric_limits<nupic::Real32>::max());

    int nScores = int(c.end() - c.begin());
    for (int i = 0; i != nScores; ++i) 
      s.set(c.get(i), std::min(s.get(c.get(i)), d.get(i)));

    return s.forPython();
 }



  inline nupic::Real32 l2_norm(PyObject* py_x)
  {
    nupic::NumpyVectorT<nupic::Real32> x(py_x);
    return nupic::l2_norm(x.begin(), x.end());
  }
 
SWIGINTERN nupic::Real32 nupic_Gaussian2D_Sl_nupic_Real32_Sg__eval(nupic::Gaussian2D< nupic::Real32 > const *self,nupic::Real32 x,nupic::Real32 y){
    return self->operator()(x, y);
  }

#include <nupic/math/Set.hpp>

SWIGINTERN void nupic_Set_Sl_nupic_UInt32_Sg__construct__SWIG_1(nupic::Set< nupic::UInt32 > *self,nupic::UInt32 m,PyObject *py_a){
    PyArrayObject* _a = (PyArrayObject*) py_a;
    nupic::UInt32* a = (nupic::UInt32*)(_a->data);
    nupic::UInt32 n = _a->dimensions[0];
    self->construct(m, n, a);
  }
SWIGINTERN nupic::UInt32 nupic_Set_Sl_nupic_UInt32_Sg__intersection__SWIG_1(nupic::Set< nupic::UInt32 > const *self,PyObject *py_s2,PyObject *py_r){
    PyArrayObject* _s2 = (PyArrayObject*) py_s2;
    nupic::UInt32* s2 = (nupic::UInt32*)(_s2->data);
    nupic::UInt32 n2 = _s2->dimensions[0];
    PyArrayObject* _r = (PyArrayObject*) py_r;
    nupic::UInt32* r = (nupic::UInt32*)(_r->data);

    return self->intersection(n2, s2, r);
  }

#include <py_support/NumpyVector.hpp>
#include <nupic/math/Index.hpp>
#include <nupic/math/Domain.hpp>
#include <nupic/math/SparseTensor.hpp>
#include <nupic/bindings/PySparseTensor.hpp>



  nupic::Real64 lgamma(nupic::Real64 x)
  {
    return nupic::lgamma(x);
  }

  nupic::Real64 digamma(nupic::Real64 x)
  {
    return nupic::digamma(x);
  }

  nupic::Real64 beta(nupic::Real64 x, nupic::Real64 y)
  {
    return nupic::beta(x, y);
  }

  nupic::Real64 erf(nupic::Real64 x)
  {
    return nupic::erf(x);
  }

  bool nearlyZeroRange(PyObject* py_x, nupic::Real32 eps =nupic::Epsilon)
  {
    nupic::NumpyVectorT<nupic::Real32> x(py_x);
    return nupic::nearlyZeroRange(x.begin(), x.end(), eps);
  }

  bool nearlyEqualRange(PyObject* py_x, PyObject* py_y, nupic::Real32 eps =nupic::Epsilon)
  {
    nupic::NumpyVectorT<nupic::Real32> x(py_x), y(py_y);
    return nupic::nearlyEqualRange(x.begin(), x.end(), y.begin(), y.end(), eps);
  }

  bool positive_less_than(PyObject* py_x, nupic::Real32 eps =nupic::Epsilon)
  {
    nupic::NumpyVectorT<nupic::Real32> x(py_x);
    return nupic::positive_less_than(x.begin(), x.end(), eps);
  }

  /*
  inline PyObject* quantize_255(PyObject* py_x, nupic::Real32 x_min, nupic::Real32 x_max)
  {
    nupic::NumpyVectorT<nupic::Real32> x(py_x), y(x.size());
    nupic::quantize(x.begin(), x.end(), y.begin(), y.end(),
		  x_min, x_max, 1, 255);
    return y.forPython();
  }

  inline PyObject* quantize_65535(PyObject* py_x, nupic::Real32 x_min, nupic::Real32 x_max)
  {
    nupic::NumpyVectorT<nupic::Real32> x(py_x), y(x.size());
    nupic::quantize(x.begin(), x.end(), y.begin(), y.end(),
		  x_min, x_max, 1, 65535);
    return y.forPython();
  }
  */			 

  PyObject* winnerTakesAll_3(size_t k, size_t seg_size, PyObject* py_x)
  {
    nupic::NumpyVectorT<nupic::Real32> x(py_x);
    std::vector<int> ind;
    std::vector<nupic::Real32> nz;
    nupic::winnerTakesAll3(k, seg_size, x.begin(), x.end(),
		    std::back_inserter(ind), std::back_inserter(nz));
    PyObject *toReturn = PyTuple_New(2);
    PyTuple_SET_ITEM(toReturn, 0, nupic::PyInt32Vector(ind.begin(), ind.end()));
    PyTuple_SET_ITEM(toReturn, 1, nupic::PyFloatVector(nz.begin(), nz.end()));
    return toReturn;
  }

SWIGINTERN std::string nupic_Random___getstate__(nupic::Random *self){
  std::stringstream ss;
  ss << *self;
  return ss.str();
}
SWIGINTERN std::string nupic_Random_getState(nupic::Random *self){
  std::stringstream ss;
  ss << *self;
  return ss.str();
}
SWIGINTERN void nupic_Random_setState(nupic::Random *self,std::string const &s){
  std::stringstream ss(s);
  ss >> *self;
}
SWIGINTERN void nupic_Random_setSeed(nupic::Random *self,PyObject *x){
  long seed_ = PyObject_Hash(x);
  *self = nupic::Random(seed_);
}
SWIGINTERN void nupic_Random_jumpAhead(nupic::Random *self,unsigned int n){ // WARNING: Slow!
  while(n) { self->getUInt32(nupic::Random::MAX32); --n; }
}
SWIGINTERN void nupic_Random_initializeUInt32Array(nupic::Random *self,PyObject *py_array,nupic::UInt32 max_value){
  PyArrayObject* array = (PyArrayObject*) py_array;
  nupic::UInt32* array_data = (nupic::UInt32*) array->data;
  nupic::UInt32 size = array->dimensions[0];
  for (nupic::UInt32 i = 0; i != size; ++i)
    array_data[i] = self->getUInt32() % max_value;
}
SWIGINTERN void nupic_Random_initializeReal32Array(nupic::Random *self,PyObject *py_array){
  PyArrayObject* array = (PyArrayObject*) py_array;
  nupic::Real32* array_data = (nupic::Real32*) array->data;
  nupic::UInt32 size = array->dimensions[0];
  for (nupic::UInt32 i = 0; i != size; ++i)
    array_data[i] = (nupic::Real32) self->getReal64();
}
SWIGINTERN void nupic_Random_initializeReal32Array_01(nupic::Random *self,PyObject *py_array,nupic::Real32 proba){
  PyArrayObject* array = (PyArrayObject*) py_array;
  nupic::Real32* array_data = (nupic::Real32*) array->data;
  nupic::Real32 size = array->dimensions[0];
  for (nupic::UInt32 i = 0; i != size; ++i)
    array_data[i] = (nupic::Real32)(self->getReal64() <= proba ? 1.0 : 0.0);
}
SWIGINTERN PyObject *nupic_Random_sample(nupic::Random *self,PyObject *population,PyObject *choices){
  if (PyArray_Check(population) && PyArray_Check(choices))
  {
    PyArrayObject* values = (PyArrayObject*) population;
    PyArrayObject* result = (PyArrayObject*) choices;

    if (values->nd != 1 || result->nd != 1)
    {
      PyErr_SetString(PyExc_ValueError,
                     "Only one dimensional arrays are supported.");
      return NULL;
    }

    if (PyArray_DESCR(values)->type_num != PyArray_DESCR(result)->type_num)
    {
      PyErr_SetString(
          PyExc_ValueError,
          "Type of value in polation and choices arrays must match.");
      return NULL;
    }

    try
    {
      if (PyArray_DESCR(values)->type_num == NPY_UINT32)
      {
        nupic::UInt32* valuesStart = (nupic::UInt32*) values->data;
        nupic::UInt32 valuesSize = values->dimensions[0];

        nupic::UInt32* resultStart = (nupic::UInt32*) result->data;
        nupic::UInt32 resultSize = result->dimensions[0];

        self->sample(valuesStart, valuesSize, resultStart, resultSize);
      } else if (PyArray_DESCR(values)->type_num == NPY_UINT64) {
        nupic::UInt64* valuesStart = (nupic::UInt64*) values->data;
        nupic::UInt64 valuesSize = values->dimensions[0];

        nupic::UInt64* resultStart = (nupic::UInt64*) result->data;
        nupic::UInt64 resultSize = result->dimensions[0];

        self->sample(valuesStart, valuesSize, resultStart, resultSize);
      } else {
        PyErr_SetString(PyExc_TypeError,
                       "Unexpected array dtype. Expected 'uint32' or 'uint64'.");
        return NULL;
      }
    }
    catch (nupic::LoggingException& exception)
    {
      PyErr_SetString(PyExc_ValueError, exception.getMessage());
      return NULL;
    }
  } else {
    PyErr_SetString(PyExc_TypeError,
                   "Unsupported type. Expected Numpy array.");
    return NULL;
  }

  Py_INCREF(choices);
  return choices;
}
SWIGINTERN PyObject *nupic_Random_shuffle(nupic::Random *self,PyObject *obj){
  if (PyArray_Check(obj))
  {
    PyArrayObject* arr = (PyArrayObject*) obj;

    if (arr->nd != 1)
    {
      PyErr_SetString(PyExc_ValueError,
                     "Only one dimensional arrays are supported.");
      return NULL;
    }

    if (PyArray_DESCR(arr)->type_num == NPY_UINT32)
    {
      nupic::UInt32* arrStart = (nupic::UInt32*) arr->data;
      nupic::UInt32* arrEnd = arrStart + arr->dimensions[0];

      self->shuffle(arrStart, arrEnd);
    } else if (PyArray_DESCR(arr)->type_num == NPY_UINT64) {
      nupic::UInt64* arrStart = (nupic::UInt64*) arr->data;
      nupic::UInt64* arrEnd = arrStart + arr->dimensions[0];

      self->shuffle(arrStart, arrEnd);
    } else {
      PyErr_SetString(PyExc_ValueError,
                     "Unexpected array dtype. Expected 'uint32' or 'uint64'.");
      return NULL;
    }
  } else {
    PyErr_SetString(PyExc_TypeError,
                   "Unsupported type. Expected Numpy array.");
    return NULL;
  }

  Py_INCREF(obj);
  return obj;
}
SWIGINTERN void nupic_Random_write__SWIG_2(nupic::Random const *self,PyObject *pyBuilder){
  RandomProto::Builder proto = nupic::getBuilder<RandomProto>(pyBuilder);
  self->write(proto);
}
SWIGINTERN void nupic_Random_read__SWIG_2(nupic::Random *self,PyObject *pyReader){
  RandomProto::Reader proto = nupic::getReader<RandomProto>(pyReader);
  self->read(proto);
}
#ifdef __cplusplus
extern "C" {
#endif
SWIGINTERN PyObject *_wrap_delete_SwigPyIterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 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_swig__SwigPyIterator, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_SwigPyIterator" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); 
  }
  arg1 = reinterpret_cast< swig::SwigPyIterator * >(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_SwigPyIterator_value(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 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_swig__SwigPyIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_value" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); 
  }
  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (PyObject *)((swig::SwigPyIterator const *)arg1)->value();
      }
      catch(swig::stop_iteration &_e) {
        {
          (void)_e;
          SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void());
          SWIG_fail;
        }
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't 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_SwigPyIterator_incr(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
  size_t arg2 = (size_t) 1 ;
  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 
  };
  swig::SwigPyIterator *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:SwigPyIterator_incr",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_incr" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); 
  }
  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
  if (obj1) {
    ecode2 = SWIG_AsVal_size_t(obj1, &val2);
    if (!SWIG_IsOK(ecode2)) {
      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator_incr" "', argument " "2"" of type '" "size_t""'");
    } 
    arg2 = static_cast< size_t >(val2);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (swig::SwigPyIterator *)(arg1)->incr(arg2);
      }
      catch(swig::stop_iteration &_e) {
        {
          (void)_e;
          SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void());
          SWIG_fail;
        }
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SwigPyIterator_decr(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
  size_t arg2 = (size_t) 1 ;
  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 
  };
  swig::SwigPyIterator *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:SwigPyIterator_decr",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_decr" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); 
  }
  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
  if (obj1) {
    ecode2 = SWIG_AsVal_size_t(obj1, &val2);
    if (!SWIG_IsOK(ecode2)) {
      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator_decr" "', argument " "2"" of type '" "size_t""'");
    } 
    arg2 = static_cast< size_t >(val2);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (swig::SwigPyIterator *)(arg1)->decr(arg2);
      }
      catch(swig::stop_iteration &_e) {
        {
          (void)_e;
          SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void());
          SWIG_fail;
        }
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SwigPyIterator_distance(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
  swig::SwigPyIterator *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 
  };
  ptrdiff_t result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SwigPyIterator_distance",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_distance" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); 
  }
  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_swig__SwigPyIterator,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SwigPyIterator_distance" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SwigPyIterator_distance" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); 
  }
  arg2 = reinterpret_cast< swig::SwigPyIterator * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = ((swig::SwigPyIterator const *)arg1)->distance((swig::SwigPyIterator const &)*arg2);
      }
      catch(std::invalid_argument &_e) {
        SWIG_Python_Raise(SWIG_NewPointerObj((new std::invalid_argument(static_cast< const std::invalid_argument& >(_e))),SWIGTYPE_p_std__invalid_argument,SWIG_POINTER_OWN), "std::invalid_argument", SWIGTYPE_p_std__invalid_argument); SWIG_fail;
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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_ptrdiff_t(static_cast< ptrdiff_t >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SwigPyIterator_equal(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
  swig::SwigPyIterator *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 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SwigPyIterator_equal",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_equal" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); 
  }
  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_swig__SwigPyIterator,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SwigPyIterator_equal" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SwigPyIterator_equal" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); 
  }
  arg2 = reinterpret_cast< swig::SwigPyIterator * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (bool)((swig::SwigPyIterator const *)arg1)->equal((swig::SwigPyIterator const &)*arg2);
      }
      catch(std::invalid_argument &_e) {
        SWIG_Python_Raise(SWIG_NewPointerObj((new std::invalid_argument(static_cast< const std::invalid_argument& >(_e))),SWIGTYPE_p_std__invalid_argument,SWIG_POINTER_OWN), "std::invalid_argument", SWIGTYPE_p_std__invalid_argument); SWIG_fail;
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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_SwigPyIterator_copy(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  swig::SwigPyIterator *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_copy" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); 
  }
  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (swig::SwigPyIterator *)((swig::SwigPyIterator const *)arg1)->copy();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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_SwigPyIterator_next(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 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_swig__SwigPyIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_next" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); 
  }
  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (PyObject *)(arg1)->next();
      }
      catch(swig::stop_iteration &_e) {
        {
          (void)_e;
          SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void());
          SWIG_fail;
        }
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't 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_SwigPyIterator___next__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 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_swig__SwigPyIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___next__" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); 
  }
  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (PyObject *)(arg1)->__next__();
      }
      catch(swig::stop_iteration &_e) {
        {
          (void)_e;
          SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void());
          SWIG_fail;
        }
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't 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_SwigPyIterator_previous(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 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_swig__SwigPyIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_previous" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); 
  }
  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (PyObject *)(arg1)->previous();
      }
      catch(swig::stop_iteration &_e) {
        {
          (void)_e;
          SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void());
          SWIG_fail;
        }
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't 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_SwigPyIterator_advance(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
  ptrdiff_t arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "n", NULL 
  };
  swig::SwigPyIterator *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SwigPyIterator_advance",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_advance" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); 
  }
  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator_advance" "', argument " "2"" of type '" "ptrdiff_t""'");
  } 
  arg2 = static_cast< ptrdiff_t >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (swig::SwigPyIterator *)(arg1)->advance(arg2);
      }
      catch(swig::stop_iteration &_e) {
        {
          (void)_e;
          SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void());
          SWIG_fail;
        }
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SwigPyIterator___eq__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
  swig::SwigPyIterator *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 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SwigPyIterator___eq__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___eq__" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); 
  }
  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_swig__SwigPyIterator,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SwigPyIterator___eq__" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SwigPyIterator___eq__" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); 
  }
  arg2 = reinterpret_cast< swig::SwigPyIterator * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((swig::SwigPyIterator const *)arg1)->operator ==((swig::SwigPyIterator 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_SwigPyIterator___ne__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
  swig::SwigPyIterator *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 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SwigPyIterator___ne__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___ne__" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); 
  }
  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_swig__SwigPyIterator,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SwigPyIterator___ne__" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SwigPyIterator___ne__" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); 
  }
  arg2 = reinterpret_cast< swig::SwigPyIterator * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((swig::SwigPyIterator const *)arg1)->operator !=((swig::SwigPyIterator 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_SwigPyIterator___iadd__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
  ptrdiff_t arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "n", NULL 
  };
  swig::SwigPyIterator *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SwigPyIterator___iadd__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___iadd__" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); 
  }
  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator___iadd__" "', argument " "2"" of type '" "ptrdiff_t""'");
  } 
  arg2 = static_cast< ptrdiff_t >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (swig::SwigPyIterator *) &(arg1)->operator +=(arg2);
      }
      catch(swig::stop_iteration &_e) {
        {
          (void)_e;
          SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void());
          SWIG_fail;
        }
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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_SwigPyIterator___isub__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
  ptrdiff_t arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "n", NULL 
  };
  swig::SwigPyIterator *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SwigPyIterator___isub__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___isub__" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); 
  }
  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator___isub__" "', argument " "2"" of type '" "ptrdiff_t""'");
  } 
  arg2 = static_cast< ptrdiff_t >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (swig::SwigPyIterator *) &(arg1)->operator -=(arg2);
      }
      catch(swig::stop_iteration &_e) {
        {
          (void)_e;
          SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void());
          SWIG_fail;
        }
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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_SwigPyIterator___add__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
  ptrdiff_t arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "n", NULL 
  };
  swig::SwigPyIterator *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SwigPyIterator___add__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___add__" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); 
  }
  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator___add__" "', argument " "2"" of type '" "ptrdiff_t""'");
  } 
  arg2 = static_cast< ptrdiff_t >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (swig::SwigPyIterator *)((swig::SwigPyIterator const *)arg1)->operator +(arg2);
      }
      catch(swig::stop_iteration &_e) {
        {
          (void)_e;
          SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void());
          SWIG_fail;
        }
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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_SwigPyIterator___sub____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
  ptrdiff_t arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  swig::SwigPyIterator *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___sub__" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); 
  }
  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator___sub__" "', argument " "2"" of type '" "ptrdiff_t""'");
  } 
  arg2 = static_cast< ptrdiff_t >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (swig::SwigPyIterator *)((swig::SwigPyIterator const *)arg1)->operator -(arg2);
      }
      catch(swig::stop_iteration &_e) {
        {
          (void)_e;
          SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void());
          SWIG_fail;
        }
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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_SwigPyIterator___sub____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
  swig::SwigPyIterator *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  ptrdiff_t result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___sub__" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); 
  }
  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_swig__SwigPyIterator,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SwigPyIterator___sub__" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SwigPyIterator___sub__" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); 
  }
  arg2 = reinterpret_cast< swig::SwigPyIterator * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((swig::SwigPyIterator const *)arg1)->operator -((swig::SwigPyIterator 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_ptrdiff_t(static_cast< ptrdiff_t >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SwigPyIterator___sub__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"SwigPyIterator___sub__",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_swig__SwigPyIterator, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_swig__SwigPyIterator, 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_swig__SwigPyIterator, 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_SwigPyIterator___sub____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_SwigPyIterator___sub____SWIG_0(self, argc, argv);
    }
  }
  
fail:
  Py_INCREF(Py_NotImplemented);
  return Py_NotImplemented;
}


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

SWIGINTERN PyObject *_wrap_VectorOfInt32_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 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_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32_iterator" "', argument " "1"" of type '" "std::vector< NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (swig::SwigPyIterator *)std_vector_Sl_NTA_Int32_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_VectorOfInt32___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 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_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32___nonzero__" "', argument " "1"" of type '" "std::vector< NTA_Int32 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_vector_Sl_NTA_Int32_Sg____nonzero__((std::vector< int > 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_VectorOfInt32___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 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_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32___bool__" "', argument " "1"" of type '" "std::vector< NTA_Int32 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_vector_Sl_NTA_Int32_Sg____bool__((std::vector< int > 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_VectorOfInt32___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< int >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32___len__" "', argument " "1"" of type '" "std::vector< NTA_Int32 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_NTA_Int32_Sg____len__((std::vector< int > 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_VectorOfInt32_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< int >::value_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32_pop" "', argument " "1"" of type '" "std::vector< NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< int >::value_type)std_vector_Sl_NTA_Int32_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_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfInt32___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 0 ;
  std::vector< int >::difference_type arg2 ;
  std::vector< int >::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< int,std::allocator< int > > *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:VectorOfInt32___getslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32___getslice__" "', argument " "1"" of type '" "std::vector< NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfInt32___getslice__" "', argument " "2"" of type '" "std::vector< int >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< int >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfInt32___getslice__" "', argument " "3"" of type '" "std::vector< int >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< int >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< int,std::allocator< int > > *)std_vector_Sl_NTA_Int32_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_int_std__allocatorT_int_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfInt32___setslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 0 ;
  std::vector< int >::difference_type arg2 ;
  std::vector< int >::difference_type arg3 ;
  std::vector< int,std::allocator< int > > const &arg4_defvalue = std::vector< int,std::allocator< int > >() ;
  std::vector< int,std::allocator< int > > *arg4 = (std::vector< int,std::allocator< int > > *) &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:VectorOfInt32___setslice__",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32___setslice__" "', argument " "1"" of type '" "std::vector< NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfInt32___setslice__" "', argument " "2"" of type '" "std::vector< int >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< int >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfInt32___setslice__" "', argument " "3"" of type '" "std::vector< int >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< int >::difference_type >(val3);
  if (obj3) {
    {
      std::vector<int,std::allocator< int > > *ptr = (std::vector<int,std::allocator< int > > *)0;
      res4 = swig::asptr(obj3, &ptr);
      if (!SWIG_IsOK(res4)) {
        SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "VectorOfInt32___setslice__" "', argument " "4"" of type '" "std::vector< int,std::allocator< int > > const &""'"); 
      }
      if (!ptr) {
        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfInt32___setslice__" "', argument " "4"" of type '" "std::vector< int,std::allocator< int > > const &""'"); 
      }
      arg4 = ptr;
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_NTA_Int32_Sg____setslice__(arg1,arg2,arg3,(std::vector< int,std::allocator< int > > 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_VectorOfInt32___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 0 ;
  std::vector< int >::difference_type arg2 ;
  std::vector< int >::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:VectorOfInt32___delslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32___delslice__" "', argument " "1"" of type '" "std::vector< NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfInt32___delslice__" "', argument " "2"" of type '" "std::vector< int >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< int >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfInt32___delslice__" "', argument " "3"" of type '" "std::vector< int >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< int >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_NTA_Int32_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_VectorOfInt32___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 0 ;
  std::vector< int >::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_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32___delitem__" "', argument " "1"" of type '" "std::vector< NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfInt32___delitem__" "', argument " "2"" of type '" "std::vector< int >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< int >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_NTA_Int32_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_VectorOfInt32___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< int,std::allocator< int > > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32___getitem__" "', argument " "1"" of type '" "std::vector< NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfInt32___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< int,std::allocator< int > > *)std_vector_Sl_NTA_Int32_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_int_std__allocatorT_int_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfInt32___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  std::vector< int,std::allocator< int > > *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_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32___setitem__" "', argument " "1"" of type '" "std::vector< NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfInt32___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    std::vector<int,std::allocator< int > > *ptr = (std::vector<int,std::allocator< int > > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VectorOfInt32___setitem__" "', argument " "3"" of type '" "std::vector< int,std::allocator< int > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfInt32___setitem__" "', argument " "3"" of type '" "std::vector< int,std::allocator< int > > const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_NTA_Int32_Sg____setitem____SWIG_0(arg1,arg2,(std::vector< int,std::allocator< int > > 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_VectorOfInt32___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 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_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32___setitem__" "', argument " "1"" of type '" "std::vector< NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfInt32___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_NTA_Int32_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_VectorOfInt32___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 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_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32___delitem__" "', argument " "1"" of type '" "std::vector< NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfInt32___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_NTA_Int32_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_VectorOfInt32___delitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfInt32___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<int,std::allocator< int > >**)(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<int,std::allocator< int > >**)(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_VectorOfInt32___delitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_VectorOfInt32___delitem____SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfInt32___delitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_Int32 >::__delitem__(std::vector< int >::difference_type)\n"
    "    std::vector< NTA_Int32 >::__delitem__(PySliceObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfInt32___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 0 ;
  std::vector< int >::difference_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  std::vector< int >::value_type *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32___getitem__" "', argument " "1"" of type '" "std::vector< NTA_Int32 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfInt32___getitem__" "', argument " "2"" of type '" "std::vector< int >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< int >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< int >::value_type *) &std_vector_Sl_NTA_Int32_Sg____getitem____SWIG_1((std::vector< int > 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_int(static_cast< int >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfInt32___getitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfInt32___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<int,std::allocator< int > >**)(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<int,std::allocator< int > >**)(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_VectorOfInt32___getitem____SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfInt32___getitem____SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfInt32___getitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_Int32 >::__getitem__(PySliceObject *)\n"
    "    std::vector< NTA_Int32 >::__getitem__(std::vector< int >::difference_type) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfInt32___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 0 ;
  std::vector< int >::difference_type arg2 ;
  std::vector< int >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  std::vector< int >::value_type temp3 ;
  int val3 ;
  int ecode3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32___setitem__" "', argument " "1"" of type '" "std::vector< NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfInt32___setitem__" "', argument " "2"" of type '" "std::vector< int >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< int >::difference_type >(val2);
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfInt32___setitem__" "', argument " "3"" of type '" "std::vector< int >::value_type""'");
  } 
  temp3 = static_cast< std::vector< int >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_NTA_Int32_Sg____setitem____SWIG_2(arg1,arg2,(int 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_VectorOfInt32___setitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfInt32___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<int,std::allocator< int > >**)(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<int,std::allocator< int > >**)(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<int,std::allocator< int > >**)(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<int,std::allocator< int > >**)(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_int(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_VectorOfInt32___setitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_VectorOfInt32___setitem____SWIG_0(self, argc, argv);
    case 3:
      return _wrap_VectorOfInt32___setitem____SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfInt32___setitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_Int32 >::__setitem__(PySliceObject *,std::vector< int,std::allocator< int > > const &)\n"
    "    std::vector< NTA_Int32 >::__setitem__(PySliceObject *)\n"
    "    std::vector< NTA_Int32 >::__setitem__(std::vector< int >::difference_type,std::vector< int >::value_type const &)\n");
  return 0;
}


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


SWIGINTERN PyObject *_wrap_new_VectorOfInt32__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  std::vector< NTA_Int32 > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  {
    std::vector<int,std::allocator< int > > *ptr = (std::vector<int,std::allocator< int > > *)0;
    res1 = swig::asptr(swig_obj[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_VectorOfInt32" "', argument " "1"" of type '" "std::vector< NTA_Int32 > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VectorOfInt32" "', argument " "1"" of type '" "std::vector< NTA_Int32 > const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< NTA_Int32 > *)new std::vector< NTA_Int32 >((std::vector< NTA_Int32 > 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_int_std__allocatorT_int_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_VectorOfInt32_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 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_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32_empty" "', argument " "1"" of type '" "std::vector< NTA_Int32 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((std::vector< NTA_Int32 > 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_VectorOfInt32_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< int >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32_size" "', argument " "1"" of type '" "std::vector< NTA_Int32 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< NTA_Int32 > 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_VectorOfInt32_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 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_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32_clear" "', argument " "1"" of type '" "std::vector< NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(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_VectorOfInt32_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 0 ;
  std::vector< NTA_Int32 > *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:VectorOfInt32_swap",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32_swap" "', argument " "1"" of type '" "std::vector< NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VectorOfInt32_swap" "', argument " "2"" of type '" "std::vector< NTA_Int32 > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfInt32_swap" "', argument " "2"" of type '" "std::vector< NTA_Int32 > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< NTA_Int32 > * >(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_VectorOfInt32_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::allocator< int > > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32_get_allocator" "', argument " "1"" of type '" "std::vector< NTA_Int32 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< NTA_Int32 > 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< int >::allocator_type(static_cast< const std::vector< int >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_int_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfInt32_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< int >::iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32_begin" "', argument " "1"" of type '" "std::vector< NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(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< int >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfInt32_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< int >::iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32_end" "', argument " "1"" of type '" "std::vector< NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(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< int >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfInt32_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< int >::reverse_iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32_rbegin" "', argument " "1"" of type '" "std::vector< NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(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< int >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfInt32_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< int >::reverse_iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32_rend" "', argument " "1"" of type '" "std::vector< NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(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< int >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_VectorOfInt32__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< int >::size_type arg1 ;
  size_t val1 ;
  int ecode1 = 0 ;
  std::vector< NTA_Int32 > *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_VectorOfInt32" "', argument " "1"" of type '" "std::vector< int >::size_type""'");
  } 
  arg1 = static_cast< std::vector< int >::size_type >(val1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< NTA_Int32 > *)new std::vector< NTA_Int32 >(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_int_std__allocatorT_int_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfInt32_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 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_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32_pop_back" "', argument " "1"" of type '" "std::vector< NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(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_VectorOfInt32_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 0 ;
  std::vector< int >::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_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32_resize" "', argument " "1"" of type '" "std::vector< NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfInt32_resize" "', argument " "2"" of type '" "std::vector< int >::size_type""'");
  } 
  arg2 = static_cast< std::vector< int >::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_VectorOfInt32_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 0 ;
  SwigValueWrapper< std::vector< int >::iterator > arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  SwigValueWrapper< std::vector< int >::iterator > result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32_erase" "', argument " "1"" of type '" "std::vector< NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(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 '" "VectorOfInt32_erase" "', argument " "2"" of type '" "std::vector< int >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< int >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfInt32_erase" "', argument " "2"" of type '" "std::vector< int >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_NTA_Int32_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< int >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfInt32_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 0 ;
  SwigValueWrapper< std::vector< int >::iterator > arg2 ;
  SwigValueWrapper< std::vector< int >::iterator > arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  swig::SwigPyIterator *iter3 = 0 ;
  int res3 ;
  SwigValueWrapper< std::vector< int >::iterator > result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32_erase" "', argument " "1"" of type '" "std::vector< NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(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 '" "VectorOfInt32_erase" "', argument " "2"" of type '" "std::vector< int >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< int >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfInt32_erase" "', argument " "2"" of type '" "std::vector< int >::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 '" "VectorOfInt32_erase" "', argument " "3"" of type '" "std::vector< int >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< int >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter3);
    if (iter_t) {
      arg3 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfInt32_erase" "', argument " "3"" of type '" "std::vector< int >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_NTA_Int32_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< int >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfInt32_erase(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfInt32_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<int,std::allocator< int > >**)(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< int >::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<int,std::allocator< int > >**)(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< int >::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< int >::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_VectorOfInt32_erase__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfInt32_erase__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfInt32_erase'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_Int32 >::erase(std::vector< int >::iterator)\n"
    "    std::vector< NTA_Int32 >::erase(std::vector< int >::iterator,std::vector< int >::iterator)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_new_VectorOfInt32__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< int >::size_type arg1 ;
  std::vector< int >::value_type *arg2 = 0 ;
  size_t val1 ;
  int ecode1 = 0 ;
  std::vector< int >::value_type temp2 ;
  int val2 ;
  int ecode2 = 0 ;
  std::vector< NTA_Int32 > *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_VectorOfInt32" "', argument " "1"" of type '" "std::vector< int >::size_type""'");
  } 
  arg1 = static_cast< std::vector< int >::size_type >(val1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_VectorOfInt32" "', argument " "2"" of type '" "std::vector< int >::value_type""'");
  } 
  temp2 = static_cast< std::vector< int >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< NTA_Int32 > *)new std::vector< NTA_Int32 >(arg1,(std::vector< int >::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_int_std__allocatorT_int_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_VectorOfInt32(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_VectorOfInt32",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<int,std::allocator< int > >**)(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_int(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_VectorOfInt32__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_VectorOfInt32__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_new_VectorOfInt32__SWIG_1(self, argc, argv);
    case 4:
      return _wrap_new_VectorOfInt32__SWIG_3(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_VectorOfInt32'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_Int32 >::vector()\n"
    "    std::vector< NTA_Int32 >::vector(std::vector< NTA_Int32 > const &)\n"
    "    std::vector< NTA_Int32 >::vector(std::vector< int >::size_type)\n"
    "    std::vector< NTA_Int32 >::vector(std::vector< int >::size_type,std::vector< int >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfInt32_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 0 ;
  std::vector< int >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< int >::value_type temp2 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:VectorOfInt32_push_back",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32_push_back" "', argument " "1"" of type '" "std::vector< NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfInt32_push_back" "', argument " "2"" of type '" "std::vector< int >::value_type""'");
  } 
  temp2 = static_cast< std::vector< int >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->push_back((std::vector< int >::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_VectorOfInt32_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< int >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32_front" "', argument " "1"" of type '" "std::vector< NTA_Int32 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< int >::value_type *) &((std::vector< NTA_Int32 > 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_int(static_cast< int >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfInt32_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< int >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32_back" "', argument " "1"" of type '" "std::vector< NTA_Int32 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< int >::value_type *) &((std::vector< NTA_Int32 > 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_int(static_cast< int >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfInt32_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 0 ;
  std::vector< int >::size_type arg2 ;
  std::vector< int >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  std::vector< int >::value_type temp3 ;
  int 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:VectorOfInt32_assign",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32_assign" "', argument " "1"" of type '" "std::vector< NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfInt32_assign" "', argument " "2"" of type '" "std::vector< int >::size_type""'");
  } 
  arg2 = static_cast< std::vector< int >::size_type >(val2);
  ecode3 = SWIG_AsVal_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfInt32_assign" "', argument " "3"" of type '" "std::vector< int >::value_type""'");
  } 
  temp3 = static_cast< std::vector< int >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->assign(arg2,(std::vector< int >::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_VectorOfInt32_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 0 ;
  std::vector< int >::size_type arg2 ;
  std::vector< int >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  std::vector< int >::value_type temp3 ;
  int val3 ;
  int ecode3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32_resize" "', argument " "1"" of type '" "std::vector< NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfInt32_resize" "', argument " "2"" of type '" "std::vector< int >::size_type""'");
  } 
  arg2 = static_cast< std::vector< int >::size_type >(val2);
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfInt32_resize" "', argument " "3"" of type '" "std::vector< int >::value_type""'");
  } 
  temp3 = static_cast< std::vector< int >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resize(arg2,(std::vector< int >::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_VectorOfInt32_resize(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfInt32_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<int,std::allocator< int > >**)(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<int,std::allocator< int > >**)(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_int(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_VectorOfInt32_resize__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfInt32_resize__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfInt32_resize'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_Int32 >::resize(std::vector< int >::size_type)\n"
    "    std::vector< NTA_Int32 >::resize(std::vector< int >::size_type,std::vector< int >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfInt32_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 0 ;
  SwigValueWrapper< std::vector< int >::iterator > arg2 ;
  std::vector< int >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  std::vector< int >::value_type temp3 ;
  int val3 ;
  int ecode3 = 0 ;
  SwigValueWrapper< std::vector< int >::iterator > result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32_insert" "', argument " "1"" of type '" "std::vector< NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(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 '" "VectorOfInt32_insert" "', argument " "2"" of type '" "std::vector< int >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< int >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfInt32_insert" "', argument " "2"" of type '" "std::vector< int >::iterator""'");
    }
  }
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfInt32_insert" "', argument " "3"" of type '" "std::vector< int >::value_type""'");
  } 
  temp3 = static_cast< std::vector< int >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_NTA_Int32_Sg__insert__SWIG_0(arg1,arg2,(int 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< int >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfInt32_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 0 ;
  SwigValueWrapper< std::vector< int >::iterator > arg2 ;
  std::vector< int >::size_type arg3 ;
  std::vector< int >::value_type *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  size_t val3 ;
  int ecode3 = 0 ;
  std::vector< int >::value_type temp4 ;
  int val4 ;
  int ecode4 = 0 ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32_insert" "', argument " "1"" of type '" "std::vector< NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(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 '" "VectorOfInt32_insert" "', argument " "2"" of type '" "std::vector< int >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< int >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfInt32_insert" "', argument " "2"" of type '" "std::vector< int >::iterator""'");
    }
  }
  ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfInt32_insert" "', argument " "3"" of type '" "std::vector< int >::size_type""'");
  } 
  arg3 = static_cast< std::vector< int >::size_type >(val3);
  ecode4 = SWIG_AsVal_int(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "VectorOfInt32_insert" "', argument " "4"" of type '" "std::vector< int >::value_type""'");
  } 
  temp4 = static_cast< std::vector< int >::value_type >(val4);
  arg4 = &temp4;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_vector_Sl_NTA_Int32_Sg__insert__SWIG_1(arg1,arg2,arg3,(int 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_VectorOfInt32_insert(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfInt32_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<int,std::allocator< int > >**)(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< int >::iterator > *>(iter) != 0));
      }
      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;
      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<int,std::allocator< int > >**)(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< int >::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_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_VectorOfInt32_insert__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfInt32_insert__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfInt32_insert'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_Int32 >::insert(std::vector< int >::iterator,std::vector< int >::value_type const &)\n"
    "    std::vector< NTA_Int32 >::insert(std::vector< int >::iterator,std::vector< int >::size_type,std::vector< int >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfInt32_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 0 ;
  std::vector< int >::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:VectorOfInt32_reserve",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32_reserve" "', argument " "1"" of type '" "std::vector< NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfInt32_reserve" "', argument " "2"" of type '" "std::vector< int >::size_type""'");
  } 
  arg2 = static_cast< std::vector< int >::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_VectorOfInt32_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< int >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt32_capacity" "', argument " "1"" of type '" "std::vector< NTA_Int32 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< NTA_Int32 > 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_VectorOfInt32(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int32 > *arg1 = (std::vector< NTA_Int32 > *) 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_int_std__allocatorT_int_t_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_VectorOfInt32" "', argument " "1"" of type '" "std::vector< NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int32 > * >(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 *VectorOfInt32_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_int_std__allocatorT_int_t_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_VectorOfInt64_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 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_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64_iterator" "', argument " "1"" of type '" "std::vector< NTA_Int64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (swig::SwigPyIterator *)std_vector_Sl_NTA_Int64_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_VectorOfInt64___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 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_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64___nonzero__" "', argument " "1"" of type '" "std::vector< NTA_Int64 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_vector_Sl_NTA_Int64_Sg____nonzero__((std::vector< long > 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_VectorOfInt64___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 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_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64___bool__" "', argument " "1"" of type '" "std::vector< NTA_Int64 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_vector_Sl_NTA_Int64_Sg____bool__((std::vector< long > 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_VectorOfInt64___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< long >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64___len__" "', argument " "1"" of type '" "std::vector< NTA_Int64 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_NTA_Int64_Sg____len__((std::vector< long > 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_VectorOfInt64_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< long >::value_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64_pop" "', argument " "1"" of type '" "std::vector< NTA_Int64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< long >::value_type)std_vector_Sl_NTA_Int64_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_long(static_cast< long >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfInt64___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 0 ;
  std::vector< long >::difference_type arg2 ;
  std::vector< long >::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< long,std::allocator< long > > *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:VectorOfInt64___getslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64___getslice__" "', argument " "1"" of type '" "std::vector< NTA_Int64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfInt64___getslice__" "', argument " "2"" of type '" "std::vector< long >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< long >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfInt64___getslice__" "', argument " "3"" of type '" "std::vector< long >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< long >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< long,std::allocator< long > > *)std_vector_Sl_NTA_Int64_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_long_std__allocatorT_long_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfInt64___setslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 0 ;
  std::vector< long >::difference_type arg2 ;
  std::vector< long >::difference_type arg3 ;
  std::vector< long,std::allocator< long > > const &arg4_defvalue = std::vector< long,std::allocator< long > >() ;
  std::vector< long,std::allocator< long > > *arg4 = (std::vector< long,std::allocator< long > > *) &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:VectorOfInt64___setslice__",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64___setslice__" "', argument " "1"" of type '" "std::vector< NTA_Int64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfInt64___setslice__" "', argument " "2"" of type '" "std::vector< long >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< long >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfInt64___setslice__" "', argument " "3"" of type '" "std::vector< long >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< long >::difference_type >(val3);
  if (obj3) {
    {
      std::vector<long,std::allocator< long > > *ptr = (std::vector<long,std::allocator< long > > *)0;
      res4 = swig::asptr(obj3, &ptr);
      if (!SWIG_IsOK(res4)) {
        SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "VectorOfInt64___setslice__" "', argument " "4"" of type '" "std::vector< long,std::allocator< long > > const &""'"); 
      }
      if (!ptr) {
        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfInt64___setslice__" "', argument " "4"" of type '" "std::vector< long,std::allocator< long > > const &""'"); 
      }
      arg4 = ptr;
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_NTA_Int64_Sg____setslice__(arg1,arg2,arg3,(std::vector< long,std::allocator< long > > 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_VectorOfInt64___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 0 ;
  std::vector< long >::difference_type arg2 ;
  std::vector< long >::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:VectorOfInt64___delslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64___delslice__" "', argument " "1"" of type '" "std::vector< NTA_Int64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfInt64___delslice__" "', argument " "2"" of type '" "std::vector< long >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< long >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfInt64___delslice__" "', argument " "3"" of type '" "std::vector< long >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< long >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_NTA_Int64_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_VectorOfInt64___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 0 ;
  std::vector< long >::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_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64___delitem__" "', argument " "1"" of type '" "std::vector< NTA_Int64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfInt64___delitem__" "', argument " "2"" of type '" "std::vector< long >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< long >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_NTA_Int64_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_VectorOfInt64___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< long,std::allocator< long > > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64___getitem__" "', argument " "1"" of type '" "std::vector< NTA_Int64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfInt64___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< long,std::allocator< long > > *)std_vector_Sl_NTA_Int64_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_long_std__allocatorT_long_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfInt64___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  std::vector< long,std::allocator< long > > *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_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64___setitem__" "', argument " "1"" of type '" "std::vector< NTA_Int64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfInt64___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    std::vector<long,std::allocator< long > > *ptr = (std::vector<long,std::allocator< long > > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VectorOfInt64___setitem__" "', argument " "3"" of type '" "std::vector< long,std::allocator< long > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfInt64___setitem__" "', argument " "3"" of type '" "std::vector< long,std::allocator< long > > const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_NTA_Int64_Sg____setitem____SWIG_0(arg1,arg2,(std::vector< long,std::allocator< long > > 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_VectorOfInt64___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 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_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64___setitem__" "', argument " "1"" of type '" "std::vector< NTA_Int64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfInt64___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_NTA_Int64_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_VectorOfInt64___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 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_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64___delitem__" "', argument " "1"" of type '" "std::vector< NTA_Int64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfInt64___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_NTA_Int64_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_VectorOfInt64___delitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfInt64___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<long,std::allocator< long > >**)(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<long,std::allocator< long > >**)(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_VectorOfInt64___delitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_VectorOfInt64___delitem____SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfInt64___delitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_Int64 >::__delitem__(std::vector< long >::difference_type)\n"
    "    std::vector< NTA_Int64 >::__delitem__(PySliceObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfInt64___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 0 ;
  std::vector< long >::difference_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  std::vector< long >::value_type *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64___getitem__" "', argument " "1"" of type '" "std::vector< NTA_Int64 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfInt64___getitem__" "', argument " "2"" of type '" "std::vector< long >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< long >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< long >::value_type *) &std_vector_Sl_NTA_Int64_Sg____getitem____SWIG_1((std::vector< long > 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_long(static_cast< long >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfInt64___getitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfInt64___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<long,std::allocator< long > >**)(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<long,std::allocator< long > >**)(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_VectorOfInt64___getitem____SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfInt64___getitem____SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfInt64___getitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_Int64 >::__getitem__(PySliceObject *)\n"
    "    std::vector< NTA_Int64 >::__getitem__(std::vector< long >::difference_type) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfInt64___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 0 ;
  std::vector< long >::difference_type arg2 ;
  std::vector< long >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  std::vector< long >::value_type temp3 ;
  long val3 ;
  int ecode3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64___setitem__" "', argument " "1"" of type '" "std::vector< NTA_Int64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfInt64___setitem__" "', argument " "2"" of type '" "std::vector< long >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< long >::difference_type >(val2);
  ecode3 = SWIG_AsVal_long(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfInt64___setitem__" "', argument " "3"" of type '" "std::vector< long >::value_type""'");
  } 
  temp3 = static_cast< std::vector< long >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_NTA_Int64_Sg____setitem____SWIG_2(arg1,arg2,(long 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_VectorOfInt64___setitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfInt64___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<long,std::allocator< long > >**)(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<long,std::allocator< long > >**)(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<long,std::allocator< long > >**)(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<long,std::allocator< long > >**)(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_long(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_VectorOfInt64___setitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_VectorOfInt64___setitem____SWIG_0(self, argc, argv);
    case 3:
      return _wrap_VectorOfInt64___setitem____SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfInt64___setitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_Int64 >::__setitem__(PySliceObject *,std::vector< long,std::allocator< long > > const &)\n"
    "    std::vector< NTA_Int64 >::__setitem__(PySliceObject *)\n"
    "    std::vector< NTA_Int64 >::__setitem__(std::vector< long >::difference_type,std::vector< long >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfInt64_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 0 ;
  std::vector< long >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< long >::value_type temp2 ;
  long val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:VectorOfInt64_append",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64_append" "', argument " "1"" of type '" "std::vector< NTA_Int64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(argp1);
  ecode2 = SWIG_AsVal_long(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfInt64_append" "', argument " "2"" of type '" "std::vector< long >::value_type""'");
  } 
  temp2 = static_cast< std::vector< long >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_vector_Sl_NTA_Int64_Sg__append(arg1,(long 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_VectorOfInt64__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *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< NTA_Int64 > *)new std::vector< NTA_Int64 >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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_long_std__allocatorT_long_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_VectorOfInt64__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  std::vector< NTA_Int64 > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  {
    std::vector<long,std::allocator< long > > *ptr = (std::vector<long,std::allocator< long > > *)0;
    res1 = swig::asptr(swig_obj[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_VectorOfInt64" "', argument " "1"" of type '" "std::vector< NTA_Int64 > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VectorOfInt64" "', argument " "1"" of type '" "std::vector< NTA_Int64 > const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< NTA_Int64 > *)new std::vector< NTA_Int64 >((std::vector< NTA_Int64 > 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_long_std__allocatorT_long_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_VectorOfInt64_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 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_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64_empty" "', argument " "1"" of type '" "std::vector< NTA_Int64 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((std::vector< NTA_Int64 > 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_VectorOfInt64_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< long >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64_size" "', argument " "1"" of type '" "std::vector< NTA_Int64 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< NTA_Int64 > 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_VectorOfInt64_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 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_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64_clear" "', argument " "1"" of type '" "std::vector< NTA_Int64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(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_VectorOfInt64_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 0 ;
  std::vector< NTA_Int64 > *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:VectorOfInt64_swap",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64_swap" "', argument " "1"" of type '" "std::vector< NTA_Int64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_long_std__allocatorT_long_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VectorOfInt64_swap" "', argument " "2"" of type '" "std::vector< NTA_Int64 > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfInt64_swap" "', argument " "2"" of type '" "std::vector< NTA_Int64 > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< NTA_Int64 > * >(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_VectorOfInt64_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::allocator< long > > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64_get_allocator" "', argument " "1"" of type '" "std::vector< NTA_Int64 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< NTA_Int64 > 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< long >::allocator_type(static_cast< const std::vector< long >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_long_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfInt64_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< long >::iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64_begin" "', argument " "1"" of type '" "std::vector< NTA_Int64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(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< long >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfInt64_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< long >::iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64_end" "', argument " "1"" of type '" "std::vector< NTA_Int64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(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< long >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfInt64_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< long >::reverse_iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64_rbegin" "', argument " "1"" of type '" "std::vector< NTA_Int64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(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< long >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfInt64_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< long >::reverse_iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64_rend" "', argument " "1"" of type '" "std::vector< NTA_Int64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(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< long >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_VectorOfInt64__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< long >::size_type arg1 ;
  size_t val1 ;
  int ecode1 = 0 ;
  std::vector< NTA_Int64 > *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_VectorOfInt64" "', argument " "1"" of type '" "std::vector< long >::size_type""'");
  } 
  arg1 = static_cast< std::vector< long >::size_type >(val1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< NTA_Int64 > *)new std::vector< NTA_Int64 >(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_long_std__allocatorT_long_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfInt64_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 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_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64_pop_back" "', argument " "1"" of type '" "std::vector< NTA_Int64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(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_VectorOfInt64_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 0 ;
  std::vector< long >::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_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64_resize" "', argument " "1"" of type '" "std::vector< NTA_Int64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfInt64_resize" "', argument " "2"" of type '" "std::vector< long >::size_type""'");
  } 
  arg2 = static_cast< std::vector< long >::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_VectorOfInt64_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 0 ;
  SwigValueWrapper< std::vector< long >::iterator > arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  SwigValueWrapper< std::vector< long >::iterator > result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64_erase" "', argument " "1"" of type '" "std::vector< NTA_Int64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(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 '" "VectorOfInt64_erase" "', argument " "2"" of type '" "std::vector< long >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< long >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< long >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfInt64_erase" "', argument " "2"" of type '" "std::vector< long >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_NTA_Int64_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< long >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfInt64_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 0 ;
  SwigValueWrapper< std::vector< long >::iterator > arg2 ;
  SwigValueWrapper< std::vector< long >::iterator > arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  swig::SwigPyIterator *iter3 = 0 ;
  int res3 ;
  SwigValueWrapper< std::vector< long >::iterator > result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64_erase" "', argument " "1"" of type '" "std::vector< NTA_Int64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(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 '" "VectorOfInt64_erase" "', argument " "2"" of type '" "std::vector< long >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< long >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< long >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfInt64_erase" "', argument " "2"" of type '" "std::vector< long >::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 '" "VectorOfInt64_erase" "', argument " "3"" of type '" "std::vector< long >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< long >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< long >::iterator > *>(iter3);
    if (iter_t) {
      arg3 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfInt64_erase" "', argument " "3"" of type '" "std::vector< long >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_NTA_Int64_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< long >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfInt64_erase(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfInt64_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<long,std::allocator< long > >**)(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< long >::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<long,std::allocator< long > >**)(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< long >::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< long >::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_VectorOfInt64_erase__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfInt64_erase__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfInt64_erase'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_Int64 >::erase(std::vector< long >::iterator)\n"
    "    std::vector< NTA_Int64 >::erase(std::vector< long >::iterator,std::vector< long >::iterator)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_new_VectorOfInt64__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< long >::size_type arg1 ;
  std::vector< long >::value_type *arg2 = 0 ;
  size_t val1 ;
  int ecode1 = 0 ;
  std::vector< long >::value_type temp2 ;
  long val2 ;
  int ecode2 = 0 ;
  std::vector< NTA_Int64 > *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_VectorOfInt64" "', argument " "1"" of type '" "std::vector< long >::size_type""'");
  } 
  arg1 = static_cast< std::vector< long >::size_type >(val1);
  ecode2 = SWIG_AsVal_long(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_VectorOfInt64" "', argument " "2"" of type '" "std::vector< long >::value_type""'");
  } 
  temp2 = static_cast< std::vector< long >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< NTA_Int64 > *)new std::vector< NTA_Int64 >(arg1,(std::vector< long >::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_long_std__allocatorT_long_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_VectorOfInt64(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_VectorOfInt64",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<long,std::allocator< long > >**)(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_long(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_VectorOfInt64__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_VectorOfInt64__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_new_VectorOfInt64__SWIG_1(self, argc, argv);
    case 4:
      return _wrap_new_VectorOfInt64__SWIG_3(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_VectorOfInt64'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_Int64 >::vector()\n"
    "    std::vector< NTA_Int64 >::vector(std::vector< NTA_Int64 > const &)\n"
    "    std::vector< NTA_Int64 >::vector(std::vector< long >::size_type)\n"
    "    std::vector< NTA_Int64 >::vector(std::vector< long >::size_type,std::vector< long >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfInt64_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 0 ;
  std::vector< long >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< long >::value_type temp2 ;
  long val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:VectorOfInt64_push_back",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64_push_back" "', argument " "1"" of type '" "std::vector< NTA_Int64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(argp1);
  ecode2 = SWIG_AsVal_long(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfInt64_push_back" "', argument " "2"" of type '" "std::vector< long >::value_type""'");
  } 
  temp2 = static_cast< std::vector< long >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->push_back((std::vector< long >::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_VectorOfInt64_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< long >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64_front" "', argument " "1"" of type '" "std::vector< NTA_Int64 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< long >::value_type *) &((std::vector< NTA_Int64 > 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_long(static_cast< long >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfInt64_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< long >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64_back" "', argument " "1"" of type '" "std::vector< NTA_Int64 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< long >::value_type *) &((std::vector< NTA_Int64 > 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_long(static_cast< long >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfInt64_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 0 ;
  std::vector< long >::size_type arg2 ;
  std::vector< long >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  std::vector< long >::value_type temp3 ;
  long 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:VectorOfInt64_assign",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64_assign" "', argument " "1"" of type '" "std::vector< NTA_Int64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfInt64_assign" "', argument " "2"" of type '" "std::vector< long >::size_type""'");
  } 
  arg2 = static_cast< std::vector< long >::size_type >(val2);
  ecode3 = SWIG_AsVal_long(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfInt64_assign" "', argument " "3"" of type '" "std::vector< long >::value_type""'");
  } 
  temp3 = static_cast< std::vector< long >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->assign(arg2,(std::vector< long >::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_VectorOfInt64_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 0 ;
  std::vector< long >::size_type arg2 ;
  std::vector< long >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  std::vector< long >::value_type temp3 ;
  long val3 ;
  int ecode3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64_resize" "', argument " "1"" of type '" "std::vector< NTA_Int64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfInt64_resize" "', argument " "2"" of type '" "std::vector< long >::size_type""'");
  } 
  arg2 = static_cast< std::vector< long >::size_type >(val2);
  ecode3 = SWIG_AsVal_long(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfInt64_resize" "', argument " "3"" of type '" "std::vector< long >::value_type""'");
  } 
  temp3 = static_cast< std::vector< long >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resize(arg2,(std::vector< long >::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_VectorOfInt64_resize(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfInt64_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<long,std::allocator< long > >**)(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<long,std::allocator< long > >**)(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_long(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_VectorOfInt64_resize__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfInt64_resize__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfInt64_resize'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_Int64 >::resize(std::vector< long >::size_type)\n"
    "    std::vector< NTA_Int64 >::resize(std::vector< long >::size_type,std::vector< long >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfInt64_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 0 ;
  SwigValueWrapper< std::vector< long >::iterator > arg2 ;
  std::vector< long >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  std::vector< long >::value_type temp3 ;
  long val3 ;
  int ecode3 = 0 ;
  SwigValueWrapper< std::vector< long >::iterator > result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64_insert" "', argument " "1"" of type '" "std::vector< NTA_Int64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(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 '" "VectorOfInt64_insert" "', argument " "2"" of type '" "std::vector< long >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< long >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< long >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfInt64_insert" "', argument " "2"" of type '" "std::vector< long >::iterator""'");
    }
  }
  ecode3 = SWIG_AsVal_long(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfInt64_insert" "', argument " "3"" of type '" "std::vector< long >::value_type""'");
  } 
  temp3 = static_cast< std::vector< long >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_NTA_Int64_Sg__insert__SWIG_0(arg1,arg2,(long 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< long >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfInt64_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 0 ;
  SwigValueWrapper< std::vector< long >::iterator > arg2 ;
  std::vector< long >::size_type arg3 ;
  std::vector< long >::value_type *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  size_t val3 ;
  int ecode3 = 0 ;
  std::vector< long >::value_type temp4 ;
  long val4 ;
  int ecode4 = 0 ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64_insert" "', argument " "1"" of type '" "std::vector< NTA_Int64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(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 '" "VectorOfInt64_insert" "', argument " "2"" of type '" "std::vector< long >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< long >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< long >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfInt64_insert" "', argument " "2"" of type '" "std::vector< long >::iterator""'");
    }
  }
  ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfInt64_insert" "', argument " "3"" of type '" "std::vector< long >::size_type""'");
  } 
  arg3 = static_cast< std::vector< long >::size_type >(val3);
  ecode4 = SWIG_AsVal_long(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "VectorOfInt64_insert" "', argument " "4"" of type '" "std::vector< long >::value_type""'");
  } 
  temp4 = static_cast< std::vector< long >::value_type >(val4);
  arg4 = &temp4;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_vector_Sl_NTA_Int64_Sg__insert__SWIG_1(arg1,arg2,arg3,(long 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_VectorOfInt64_insert(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfInt64_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<long,std::allocator< long > >**)(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< long >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_long(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<long,std::allocator< long > >**)(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< long >::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_long(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_VectorOfInt64_insert__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfInt64_insert__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfInt64_insert'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_Int64 >::insert(std::vector< long >::iterator,std::vector< long >::value_type const &)\n"
    "    std::vector< NTA_Int64 >::insert(std::vector< long >::iterator,std::vector< long >::size_type,std::vector< long >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfInt64_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 0 ;
  std::vector< long >::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:VectorOfInt64_reserve",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64_reserve" "', argument " "1"" of type '" "std::vector< NTA_Int64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfInt64_reserve" "', argument " "2"" of type '" "std::vector< long >::size_type""'");
  } 
  arg2 = static_cast< std::vector< long >::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_VectorOfInt64_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< long >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_long_std__allocatorT_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfInt64_capacity" "', argument " "1"" of type '" "std::vector< NTA_Int64 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< NTA_Int64 > 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_VectorOfInt64(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Int64 > *arg1 = (std::vector< NTA_Int64 > *) 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_long_std__allocatorT_long_t_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_VectorOfInt64" "', argument " "1"" of type '" "std::vector< NTA_Int64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Int64 > * >(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 *VectorOfInt64_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_long_std__allocatorT_long_t_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_VectorOfUInt32_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 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_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32_iterator" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (swig::SwigPyIterator *)std_vector_Sl_NTA_UInt32_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_VectorOfUInt32___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 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_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32___nonzero__" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_vector_Sl_NTA_UInt32_Sg____nonzero__((std::vector< unsigned int > 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_VectorOfUInt32___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 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_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32___bool__" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_vector_Sl_NTA_UInt32_Sg____bool__((std::vector< unsigned int > 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_VectorOfUInt32___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< unsigned int >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32___len__" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_NTA_UInt32_Sg____len__((std::vector< unsigned int > 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_VectorOfUInt32_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< unsigned int >::value_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32_pop" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< unsigned int >::value_type)std_vector_Sl_NTA_UInt32_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_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt32___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 0 ;
  std::vector< unsigned int >::difference_type arg2 ;
  std::vector< unsigned int >::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< unsigned int,std::allocator< unsigned int > > *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:VectorOfUInt32___getslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32___getslice__" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfUInt32___getslice__" "', argument " "2"" of type '" "std::vector< unsigned int >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< unsigned int >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfUInt32___getslice__" "', argument " "3"" of type '" "std::vector< unsigned int >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< unsigned int >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< unsigned int,std::allocator< unsigned int > > *)std_vector_Sl_NTA_UInt32_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_unsigned_int_std__allocatorT_unsigned_int_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt32___setslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 0 ;
  std::vector< unsigned int >::difference_type arg2 ;
  std::vector< unsigned int >::difference_type arg3 ;
  std::vector< unsigned int,std::allocator< unsigned int > > const &arg4_defvalue = std::vector< unsigned int,std::allocator< unsigned int > >() ;
  std::vector< unsigned int,std::allocator< unsigned int > > *arg4 = (std::vector< unsigned int,std::allocator< unsigned int > > *) &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:VectorOfUInt32___setslice__",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32___setslice__" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfUInt32___setslice__" "', argument " "2"" of type '" "std::vector< unsigned int >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< unsigned int >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfUInt32___setslice__" "', argument " "3"" of type '" "std::vector< unsigned int >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< unsigned int >::difference_type >(val3);
  if (obj3) {
    {
      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 '" "VectorOfUInt32___setslice__" "', argument " "4"" of type '" "std::vector< unsigned int,std::allocator< unsigned int > > const &""'"); 
      }
      if (!ptr) {
        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfUInt32___setslice__" "', argument " "4"" of type '" "std::vector< unsigned int,std::allocator< unsigned int > > const &""'"); 
      }
      arg4 = ptr;
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_NTA_UInt32_Sg____setslice__(arg1,arg2,arg3,(std::vector< unsigned int,std::allocator< unsigned int > > 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_VectorOfUInt32___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 0 ;
  std::vector< unsigned int >::difference_type arg2 ;
  std::vector< unsigned int >::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:VectorOfUInt32___delslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32___delslice__" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfUInt32___delslice__" "', argument " "2"" of type '" "std::vector< unsigned int >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< unsigned int >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfUInt32___delslice__" "', argument " "3"" of type '" "std::vector< unsigned int >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< unsigned int >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_NTA_UInt32_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_VectorOfUInt32___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 0 ;
  std::vector< unsigned int >::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_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32___delitem__" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfUInt32___delitem__" "', argument " "2"" of type '" "std::vector< unsigned int >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< unsigned int >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_NTA_UInt32_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_VectorOfUInt32___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< unsigned int,std::allocator< unsigned int > > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32___getitem__" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfUInt32___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< unsigned int,std::allocator< unsigned int > > *)std_vector_Sl_NTA_UInt32_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_unsigned_int_std__allocatorT_unsigned_int_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt32___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  std::vector< unsigned int,std::allocator< unsigned int > > *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_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32___setitem__" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfUInt32___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    std::vector<unsigned int,std::allocator< unsigned int > > *ptr = (std::vector<unsigned int,std::allocator< unsigned int > > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VectorOfUInt32___setitem__" "', argument " "3"" of type '" "std::vector< unsigned int,std::allocator< unsigned int > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfUInt32___setitem__" "', argument " "3"" of type '" "std::vector< unsigned int,std::allocator< unsigned int > > const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_NTA_UInt32_Sg____setitem____SWIG_0(arg1,arg2,(std::vector< unsigned int,std::allocator< unsigned int > > 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_VectorOfUInt32___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 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_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32___setitem__" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfUInt32___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_NTA_UInt32_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_VectorOfUInt32___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 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_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32___delitem__" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfUInt32___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_NTA_UInt32_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_VectorOfUInt32___delitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfUInt32___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<unsigned int,std::allocator< unsigned int > >**)(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<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_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_VectorOfUInt32___delitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_VectorOfUInt32___delitem____SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfUInt32___delitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_UInt32 >::__delitem__(std::vector< unsigned int >::difference_type)\n"
    "    std::vector< NTA_UInt32 >::__delitem__(PySliceObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt32___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 0 ;
  std::vector< unsigned int >::difference_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  std::vector< unsigned int >::value_type *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32___getitem__" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfUInt32___getitem__" "', argument " "2"" of type '" "std::vector< unsigned int >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< unsigned int >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< unsigned int >::value_type *) &std_vector_Sl_NTA_UInt32_Sg____getitem____SWIG_1((std::vector< unsigned int > 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_unsigned_SS_int(static_cast< unsigned int >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt32___getitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfUInt32___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<unsigned int,std::allocator< unsigned int > >**)(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<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_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_VectorOfUInt32___getitem____SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfUInt32___getitem____SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfUInt32___getitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_UInt32 >::__getitem__(PySliceObject *)\n"
    "    std::vector< NTA_UInt32 >::__getitem__(std::vector< unsigned int >::difference_type) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt32___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 0 ;
  std::vector< unsigned int >::difference_type arg2 ;
  std::vector< unsigned int >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  std::vector< unsigned int >::value_type temp3 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32___setitem__" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfUInt32___setitem__" "', argument " "2"" of type '" "std::vector< unsigned int >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< unsigned int >::difference_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfUInt32___setitem__" "', argument " "3"" of type '" "std::vector< unsigned int >::value_type""'");
  } 
  temp3 = static_cast< std::vector< unsigned int >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_NTA_UInt32_Sg____setitem____SWIG_2(arg1,arg2,(unsigned int 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_VectorOfUInt32___setitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfUInt32___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<unsigned int,std::allocator< unsigned int > >**)(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<unsigned int,std::allocator< unsigned int > >**)(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<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 (!_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<unsigned int,std::allocator< unsigned int > >**)(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_unsigned_SS_int(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_VectorOfUInt32___setitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_VectorOfUInt32___setitem____SWIG_0(self, argc, argv);
    case 3:
      return _wrap_VectorOfUInt32___setitem____SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfUInt32___setitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_UInt32 >::__setitem__(PySliceObject *,std::vector< unsigned int,std::allocator< unsigned int > > const &)\n"
    "    std::vector< NTA_UInt32 >::__setitem__(PySliceObject *)\n"
    "    std::vector< NTA_UInt32 >::__setitem__(std::vector< unsigned int >::difference_type,std::vector< unsigned int >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt32_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 0 ;
  std::vector< unsigned int >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< unsigned int >::value_type temp2 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:VectorOfUInt32_append",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32_append" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfUInt32_append" "', argument " "2"" of type '" "std::vector< unsigned int >::value_type""'");
  } 
  temp2 = static_cast< std::vector< unsigned int >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_vector_Sl_NTA_UInt32_Sg__append(arg1,(unsigned int 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_VectorOfUInt32__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *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< NTA_UInt32 > *)new std::vector< NTA_UInt32 >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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_unsigned_int_std__allocatorT_unsigned_int_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_VectorOfUInt32__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  std::vector< NTA_UInt32 > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) 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_VectorOfUInt32" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VectorOfUInt32" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< NTA_UInt32 > *)new std::vector< NTA_UInt32 >((std::vector< NTA_UInt32 > 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_unsigned_int_std__allocatorT_unsigned_int_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_VectorOfUInt32_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 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_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32_empty" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((std::vector< NTA_UInt32 > 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_VectorOfUInt32_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< unsigned int >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32_size" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< NTA_UInt32 > 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_VectorOfUInt32_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 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_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32_clear" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(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_VectorOfUInt32_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 0 ;
  std::vector< NTA_UInt32 > *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:VectorOfUInt32_swap",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32_swap" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(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 '" "VectorOfUInt32_swap" "', argument " "2"" of type '" "std::vector< NTA_UInt32 > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfUInt32_swap" "', argument " "2"" of type '" "std::vector< NTA_UInt32 > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< NTA_UInt32 > * >(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_VectorOfUInt32_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::allocator< unsigned int > > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32_get_allocator" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< NTA_UInt32 > 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< unsigned int >::allocator_type(static_cast< const std::vector< unsigned int >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_unsigned_int_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt32_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< unsigned int >::iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32_begin" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(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< unsigned int >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt32_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< unsigned int >::iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32_end" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(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< unsigned int >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt32_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< unsigned int >::reverse_iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32_rbegin" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(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< unsigned int >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt32_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< unsigned int >::reverse_iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32_rend" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(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< unsigned int >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_VectorOfUInt32__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< unsigned int >::size_type arg1 ;
  size_t val1 ;
  int ecode1 = 0 ;
  std::vector< NTA_UInt32 > *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_VectorOfUInt32" "', argument " "1"" of type '" "std::vector< unsigned int >::size_type""'");
  } 
  arg1 = static_cast< std::vector< unsigned int >::size_type >(val1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< NTA_UInt32 > *)new std::vector< NTA_UInt32 >(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_unsigned_int_std__allocatorT_unsigned_int_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt32_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 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_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32_pop_back" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(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_VectorOfUInt32_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 0 ;
  std::vector< unsigned int >::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_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32_resize" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfUInt32_resize" "', argument " "2"" of type '" "std::vector< unsigned int >::size_type""'");
  } 
  arg2 = static_cast< std::vector< unsigned int >::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_VectorOfUInt32_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 0 ;
  SwigValueWrapper< std::vector< unsigned int >::iterator > arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  SwigValueWrapper< std::vector< unsigned int >::iterator > result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32_erase" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(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 '" "VectorOfUInt32_erase" "', argument " "2"" of type '" "std::vector< unsigned int >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< unsigned int >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< unsigned int >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfUInt32_erase" "', argument " "2"" of type '" "std::vector< unsigned int >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_NTA_UInt32_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< unsigned int >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt32_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 0 ;
  SwigValueWrapper< std::vector< unsigned int >::iterator > arg2 ;
  SwigValueWrapper< std::vector< unsigned int >::iterator > arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  swig::SwigPyIterator *iter3 = 0 ;
  int res3 ;
  SwigValueWrapper< std::vector< unsigned int >::iterator > result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32_erase" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(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 '" "VectorOfUInt32_erase" "', argument " "2"" of type '" "std::vector< unsigned int >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< unsigned int >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< unsigned int >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfUInt32_erase" "', argument " "2"" of type '" "std::vector< unsigned int >::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 '" "VectorOfUInt32_erase" "', argument " "3"" of type '" "std::vector< unsigned int >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< unsigned int >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< unsigned int >::iterator > *>(iter3);
    if (iter_t) {
      arg3 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfUInt32_erase" "', argument " "3"" of type '" "std::vector< unsigned int >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_NTA_UInt32_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< unsigned int >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt32_erase(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfUInt32_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<unsigned int,std::allocator< unsigned int > >**)(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< unsigned int >::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<unsigned int,std::allocator< unsigned int > >**)(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< unsigned int >::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< unsigned int >::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_VectorOfUInt32_erase__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfUInt32_erase__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfUInt32_erase'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_UInt32 >::erase(std::vector< unsigned int >::iterator)\n"
    "    std::vector< NTA_UInt32 >::erase(std::vector< unsigned int >::iterator,std::vector< unsigned int >::iterator)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_new_VectorOfUInt32__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< unsigned int >::size_type arg1 ;
  std::vector< unsigned int >::value_type *arg2 = 0 ;
  size_t val1 ;
  int ecode1 = 0 ;
  std::vector< unsigned int >::value_type temp2 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  std::vector< NTA_UInt32 > *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_VectorOfUInt32" "', argument " "1"" of type '" "std::vector< unsigned int >::size_type""'");
  } 
  arg1 = static_cast< std::vector< unsigned int >::size_type >(val1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_VectorOfUInt32" "', argument " "2"" of type '" "std::vector< unsigned int >::value_type""'");
  } 
  temp2 = static_cast< std::vector< unsigned int >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< NTA_UInt32 > *)new std::vector< NTA_UInt32 >(arg1,(std::vector< unsigned int >::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_unsigned_int_std__allocatorT_unsigned_int_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_VectorOfUInt32(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_VectorOfUInt32",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<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 (!_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_unsigned_SS_int(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_VectorOfUInt32__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_VectorOfUInt32__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_new_VectorOfUInt32__SWIG_1(self, argc, argv);
    case 4:
      return _wrap_new_VectorOfUInt32__SWIG_3(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_VectorOfUInt32'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_UInt32 >::vector()\n"
    "    std::vector< NTA_UInt32 >::vector(std::vector< NTA_UInt32 > const &)\n"
    "    std::vector< NTA_UInt32 >::vector(std::vector< unsigned int >::size_type)\n"
    "    std::vector< NTA_UInt32 >::vector(std::vector< unsigned int >::size_type,std::vector< unsigned int >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt32_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 0 ;
  std::vector< unsigned int >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< unsigned int >::value_type temp2 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:VectorOfUInt32_push_back",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32_push_back" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfUInt32_push_back" "', argument " "2"" of type '" "std::vector< unsigned int >::value_type""'");
  } 
  temp2 = static_cast< std::vector< unsigned int >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->push_back((std::vector< unsigned int >::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_VectorOfUInt32_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< unsigned int >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32_front" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< unsigned int >::value_type *) &((std::vector< NTA_UInt32 > 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_unsigned_SS_int(static_cast< unsigned int >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt32_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< unsigned int >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32_back" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< unsigned int >::value_type *) &((std::vector< NTA_UInt32 > 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_unsigned_SS_int(static_cast< unsigned int >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt32_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 0 ;
  std::vector< unsigned int >::size_type arg2 ;
  std::vector< unsigned int >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  std::vector< unsigned int >::value_type temp3 ;
  unsigned int 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:VectorOfUInt32_assign",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32_assign" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfUInt32_assign" "', argument " "2"" of type '" "std::vector< unsigned int >::size_type""'");
  } 
  arg2 = static_cast< std::vector< unsigned int >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfUInt32_assign" "', argument " "3"" of type '" "std::vector< unsigned int >::value_type""'");
  } 
  temp3 = static_cast< std::vector< unsigned int >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->assign(arg2,(std::vector< unsigned int >::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_VectorOfUInt32_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 0 ;
  std::vector< unsigned int >::size_type arg2 ;
  std::vector< unsigned int >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  std::vector< unsigned int >::value_type temp3 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32_resize" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfUInt32_resize" "', argument " "2"" of type '" "std::vector< unsigned int >::size_type""'");
  } 
  arg2 = static_cast< std::vector< unsigned int >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfUInt32_resize" "', argument " "3"" of type '" "std::vector< unsigned int >::value_type""'");
  } 
  temp3 = static_cast< std::vector< unsigned int >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resize(arg2,(std::vector< unsigned int >::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_VectorOfUInt32_resize(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfUInt32_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<unsigned int,std::allocator< unsigned int > >**)(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<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_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_unsigned_SS_int(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_VectorOfUInt32_resize__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfUInt32_resize__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfUInt32_resize'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_UInt32 >::resize(std::vector< unsigned int >::size_type)\n"
    "    std::vector< NTA_UInt32 >::resize(std::vector< unsigned int >::size_type,std::vector< unsigned int >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt32_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 0 ;
  SwigValueWrapper< std::vector< unsigned int >::iterator > arg2 ;
  std::vector< unsigned int >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  std::vector< unsigned int >::value_type temp3 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  SwigValueWrapper< std::vector< unsigned int >::iterator > result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32_insert" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(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 '" "VectorOfUInt32_insert" "', argument " "2"" of type '" "std::vector< unsigned int >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< unsigned int >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< unsigned int >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfUInt32_insert" "', argument " "2"" of type '" "std::vector< unsigned int >::iterator""'");
    }
  }
  ecode3 = SWIG_AsVal_unsigned_SS_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfUInt32_insert" "', argument " "3"" of type '" "std::vector< unsigned int >::value_type""'");
  } 
  temp3 = static_cast< std::vector< unsigned int >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_NTA_UInt32_Sg__insert__SWIG_0(arg1,arg2,(unsigned int 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< unsigned int >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt32_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 0 ;
  SwigValueWrapper< std::vector< unsigned int >::iterator > arg2 ;
  std::vector< unsigned int >::size_type arg3 ;
  std::vector< unsigned int >::value_type *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  size_t val3 ;
  int ecode3 = 0 ;
  std::vector< unsigned int >::value_type temp4 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32_insert" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(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 '" "VectorOfUInt32_insert" "', argument " "2"" of type '" "std::vector< unsigned int >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< unsigned int >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< unsigned int >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfUInt32_insert" "', argument " "2"" of type '" "std::vector< unsigned int >::iterator""'");
    }
  }
  ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfUInt32_insert" "', argument " "3"" of type '" "std::vector< unsigned int >::size_type""'");
  } 
  arg3 = static_cast< std::vector< unsigned int >::size_type >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "VectorOfUInt32_insert" "', argument " "4"" of type '" "std::vector< unsigned int >::value_type""'");
  } 
  temp4 = static_cast< std::vector< unsigned int >::value_type >(val4);
  arg4 = &temp4;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_vector_Sl_NTA_UInt32_Sg__insert__SWIG_1(arg1,arg2,arg3,(unsigned int 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_VectorOfUInt32_insert(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfUInt32_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<unsigned int,std::allocator< unsigned int > >**)(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< unsigned int >::iterator > *>(iter) != 0));
      }
      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 == 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;
      {
        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< unsigned int >::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_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_VectorOfUInt32_insert__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfUInt32_insert__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfUInt32_insert'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_UInt32 >::insert(std::vector< unsigned int >::iterator,std::vector< unsigned int >::value_type const &)\n"
    "    std::vector< NTA_UInt32 >::insert(std::vector< unsigned int >::iterator,std::vector< unsigned int >::size_type,std::vector< unsigned int >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt32_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 0 ;
  std::vector< unsigned int >::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:VectorOfUInt32_reserve",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32_reserve" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfUInt32_reserve" "', argument " "2"" of type '" "std::vector< unsigned int >::size_type""'");
  } 
  arg2 = static_cast< std::vector< unsigned int >::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_VectorOfUInt32_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< unsigned int >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt32_capacity" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< NTA_UInt32 > 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_VectorOfUInt32(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt32 > *arg1 = (std::vector< NTA_UInt32 > *) 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_unsigned_int_std__allocatorT_unsigned_int_t_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_VectorOfUInt32" "', argument " "1"" of type '" "std::vector< NTA_UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt32 > * >(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 *VectorOfUInt32_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_unsigned_int_std__allocatorT_unsigned_int_t_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_VectorOfUInt64_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 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_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64_iterator" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (swig::SwigPyIterator *)std_vector_Sl_NTA_UInt64_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_VectorOfUInt64___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 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_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64___nonzero__" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_vector_Sl_NTA_UInt64_Sg____nonzero__((std::vector< unsigned long > 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_VectorOfUInt64___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 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_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64___bool__" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_vector_Sl_NTA_UInt64_Sg____bool__((std::vector< unsigned long > 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_VectorOfUInt64___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< unsigned long >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64___len__" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_NTA_UInt64_Sg____len__((std::vector< unsigned long > 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_VectorOfUInt64_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< unsigned long >::value_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64_pop" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< unsigned long >::value_type)std_vector_Sl_NTA_UInt64_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_unsigned_SS_long(static_cast< unsigned long >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt64___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 0 ;
  std::vector< unsigned long >::difference_type arg2 ;
  std::vector< unsigned long >::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< unsigned long,std::allocator< unsigned long > > *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:VectorOfUInt64___getslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64___getslice__" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfUInt64___getslice__" "', argument " "2"" of type '" "std::vector< unsigned long >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< unsigned long >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfUInt64___getslice__" "', argument " "3"" of type '" "std::vector< unsigned long >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< unsigned long >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< unsigned long,std::allocator< unsigned long > > *)std_vector_Sl_NTA_UInt64_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_unsigned_long_std__allocatorT_unsigned_long_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt64___setslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 0 ;
  std::vector< unsigned long >::difference_type arg2 ;
  std::vector< unsigned long >::difference_type arg3 ;
  std::vector< unsigned long,std::allocator< unsigned long > > const &arg4_defvalue = std::vector< unsigned long,std::allocator< unsigned long > >() ;
  std::vector< unsigned long,std::allocator< unsigned long > > *arg4 = (std::vector< unsigned long,std::allocator< unsigned long > > *) &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:VectorOfUInt64___setslice__",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64___setslice__" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfUInt64___setslice__" "', argument " "2"" of type '" "std::vector< unsigned long >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< unsigned long >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfUInt64___setslice__" "', argument " "3"" of type '" "std::vector< unsigned long >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< unsigned long >::difference_type >(val3);
  if (obj3) {
    {
      std::vector<unsigned long,std::allocator< unsigned long > > *ptr = (std::vector<unsigned long,std::allocator< unsigned long > > *)0;
      res4 = swig::asptr(obj3, &ptr);
      if (!SWIG_IsOK(res4)) {
        SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "VectorOfUInt64___setslice__" "', argument " "4"" of type '" "std::vector< unsigned long,std::allocator< unsigned long > > const &""'"); 
      }
      if (!ptr) {
        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfUInt64___setslice__" "', argument " "4"" of type '" "std::vector< unsigned long,std::allocator< unsigned long > > const &""'"); 
      }
      arg4 = ptr;
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_NTA_UInt64_Sg____setslice__(arg1,arg2,arg3,(std::vector< unsigned long,std::allocator< unsigned long > > 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_VectorOfUInt64___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 0 ;
  std::vector< unsigned long >::difference_type arg2 ;
  std::vector< unsigned long >::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:VectorOfUInt64___delslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64___delslice__" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfUInt64___delslice__" "', argument " "2"" of type '" "std::vector< unsigned long >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< unsigned long >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfUInt64___delslice__" "', argument " "3"" of type '" "std::vector< unsigned long >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< unsigned long >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_NTA_UInt64_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_VectorOfUInt64___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 0 ;
  std::vector< unsigned long >::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_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64___delitem__" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfUInt64___delitem__" "', argument " "2"" of type '" "std::vector< unsigned long >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< unsigned long >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_NTA_UInt64_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_VectorOfUInt64___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< unsigned long,std::allocator< unsigned long > > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64___getitem__" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfUInt64___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< unsigned long,std::allocator< unsigned long > > *)std_vector_Sl_NTA_UInt64_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_unsigned_long_std__allocatorT_unsigned_long_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt64___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  std::vector< unsigned long,std::allocator< unsigned long > > *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_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64___setitem__" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfUInt64___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    std::vector<unsigned long,std::allocator< unsigned long > > *ptr = (std::vector<unsigned long,std::allocator< unsigned long > > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VectorOfUInt64___setitem__" "', argument " "3"" of type '" "std::vector< unsigned long,std::allocator< unsigned long > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfUInt64___setitem__" "', argument " "3"" of type '" "std::vector< unsigned long,std::allocator< unsigned long > > const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_NTA_UInt64_Sg____setitem____SWIG_0(arg1,arg2,(std::vector< unsigned long,std::allocator< unsigned long > > 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_VectorOfUInt64___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 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_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64___setitem__" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfUInt64___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_NTA_UInt64_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_VectorOfUInt64___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 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_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64___delitem__" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfUInt64___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_NTA_UInt64_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_VectorOfUInt64___delitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfUInt64___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<unsigned long,std::allocator< unsigned long > >**)(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<unsigned long,std::allocator< unsigned long > >**)(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_VectorOfUInt64___delitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_VectorOfUInt64___delitem____SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfUInt64___delitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_UInt64 >::__delitem__(std::vector< unsigned long >::difference_type)\n"
    "    std::vector< NTA_UInt64 >::__delitem__(PySliceObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt64___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 0 ;
  std::vector< unsigned long >::difference_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  std::vector< unsigned long >::value_type *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64___getitem__" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfUInt64___getitem__" "', argument " "2"" of type '" "std::vector< unsigned long >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< unsigned long >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< unsigned long >::value_type *) &std_vector_Sl_NTA_UInt64_Sg____getitem____SWIG_1((std::vector< unsigned long > 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_unsigned_SS_long(static_cast< unsigned long >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt64___getitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfUInt64___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<unsigned long,std::allocator< unsigned long > >**)(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<unsigned long,std::allocator< unsigned long > >**)(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_VectorOfUInt64___getitem____SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfUInt64___getitem____SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfUInt64___getitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_UInt64 >::__getitem__(PySliceObject *)\n"
    "    std::vector< NTA_UInt64 >::__getitem__(std::vector< unsigned long >::difference_type) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt64___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 0 ;
  std::vector< unsigned long >::difference_type arg2 ;
  std::vector< unsigned long >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  std::vector< unsigned long >::value_type temp3 ;
  unsigned long val3 ;
  int ecode3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64___setitem__" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfUInt64___setitem__" "', argument " "2"" of type '" "std::vector< unsigned long >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< unsigned long >::difference_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_long(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfUInt64___setitem__" "', argument " "3"" of type '" "std::vector< unsigned long >::value_type""'");
  } 
  temp3 = static_cast< std::vector< unsigned long >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_NTA_UInt64_Sg____setitem____SWIG_2(arg1,arg2,(unsigned long 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_VectorOfUInt64___setitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfUInt64___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<unsigned long,std::allocator< unsigned long > >**)(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<unsigned long,std::allocator< unsigned long > >**)(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<unsigned long,std::allocator< unsigned long > >**)(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<unsigned long,std::allocator< unsigned long > >**)(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_unsigned_SS_long(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_VectorOfUInt64___setitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_VectorOfUInt64___setitem____SWIG_0(self, argc, argv);
    case 3:
      return _wrap_VectorOfUInt64___setitem____SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfUInt64___setitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_UInt64 >::__setitem__(PySliceObject *,std::vector< unsigned long,std::allocator< unsigned long > > const &)\n"
    "    std::vector< NTA_UInt64 >::__setitem__(PySliceObject *)\n"
    "    std::vector< NTA_UInt64 >::__setitem__(std::vector< unsigned long >::difference_type,std::vector< unsigned long >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt64_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 0 ;
  std::vector< unsigned long >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< unsigned long >::value_type temp2 ;
  unsigned long val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:VectorOfUInt64_append",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64_append" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_long(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfUInt64_append" "', argument " "2"" of type '" "std::vector< unsigned long >::value_type""'");
  } 
  temp2 = static_cast< std::vector< unsigned long >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_vector_Sl_NTA_UInt64_Sg__append(arg1,(unsigned long 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_VectorOfUInt64__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *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< NTA_UInt64 > *)new std::vector< NTA_UInt64 >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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_unsigned_long_std__allocatorT_unsigned_long_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_VectorOfUInt64__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  std::vector< NTA_UInt64 > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  {
    std::vector<unsigned long,std::allocator< unsigned long > > *ptr = (std::vector<unsigned long,std::allocator< unsigned long > > *)0;
    res1 = swig::asptr(swig_obj[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_VectorOfUInt64" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VectorOfUInt64" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< NTA_UInt64 > *)new std::vector< NTA_UInt64 >((std::vector< NTA_UInt64 > 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_unsigned_long_std__allocatorT_unsigned_long_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_VectorOfUInt64_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 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_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64_empty" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((std::vector< NTA_UInt64 > 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_VectorOfUInt64_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< unsigned long >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64_size" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< NTA_UInt64 > 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_VectorOfUInt64_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 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_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64_clear" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(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_VectorOfUInt64_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 0 ;
  std::vector< NTA_UInt64 > *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:VectorOfUInt64_swap",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64_swap" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VectorOfUInt64_swap" "', argument " "2"" of type '" "std::vector< NTA_UInt64 > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfUInt64_swap" "', argument " "2"" of type '" "std::vector< NTA_UInt64 > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< NTA_UInt64 > * >(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_VectorOfUInt64_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::allocator< unsigned long > > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64_get_allocator" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< NTA_UInt64 > 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< unsigned long >::allocator_type(static_cast< const std::vector< unsigned long >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_unsigned_long_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt64_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< unsigned long >::iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64_begin" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(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< unsigned long >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt64_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< unsigned long >::iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64_end" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(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< unsigned long >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt64_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< unsigned long >::reverse_iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64_rbegin" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(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< unsigned long >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt64_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< unsigned long >::reverse_iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64_rend" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(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< unsigned long >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_VectorOfUInt64__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< unsigned long >::size_type arg1 ;
  size_t val1 ;
  int ecode1 = 0 ;
  std::vector< NTA_UInt64 > *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_VectorOfUInt64" "', argument " "1"" of type '" "std::vector< unsigned long >::size_type""'");
  } 
  arg1 = static_cast< std::vector< unsigned long >::size_type >(val1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< NTA_UInt64 > *)new std::vector< NTA_UInt64 >(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_unsigned_long_std__allocatorT_unsigned_long_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt64_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 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_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64_pop_back" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(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_VectorOfUInt64_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 0 ;
  std::vector< unsigned long >::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_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64_resize" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfUInt64_resize" "', argument " "2"" of type '" "std::vector< unsigned long >::size_type""'");
  } 
  arg2 = static_cast< std::vector< unsigned long >::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_VectorOfUInt64_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 0 ;
  SwigValueWrapper< std::vector< unsigned long >::iterator > arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  SwigValueWrapper< std::vector< unsigned long >::iterator > result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64_erase" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(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 '" "VectorOfUInt64_erase" "', argument " "2"" of type '" "std::vector< unsigned long >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< unsigned long >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< unsigned long >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfUInt64_erase" "', argument " "2"" of type '" "std::vector< unsigned long >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_NTA_UInt64_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< unsigned long >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt64_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 0 ;
  SwigValueWrapper< std::vector< unsigned long >::iterator > arg2 ;
  SwigValueWrapper< std::vector< unsigned long >::iterator > arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  swig::SwigPyIterator *iter3 = 0 ;
  int res3 ;
  SwigValueWrapper< std::vector< unsigned long >::iterator > result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64_erase" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(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 '" "VectorOfUInt64_erase" "', argument " "2"" of type '" "std::vector< unsigned long >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< unsigned long >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< unsigned long >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfUInt64_erase" "', argument " "2"" of type '" "std::vector< unsigned long >::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 '" "VectorOfUInt64_erase" "', argument " "3"" of type '" "std::vector< unsigned long >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< unsigned long >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< unsigned long >::iterator > *>(iter3);
    if (iter_t) {
      arg3 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfUInt64_erase" "', argument " "3"" of type '" "std::vector< unsigned long >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_NTA_UInt64_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< unsigned long >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt64_erase(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfUInt64_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<unsigned long,std::allocator< unsigned long > >**)(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< unsigned long >::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<unsigned long,std::allocator< unsigned long > >**)(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< unsigned long >::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< unsigned long >::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_VectorOfUInt64_erase__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfUInt64_erase__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfUInt64_erase'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_UInt64 >::erase(std::vector< unsigned long >::iterator)\n"
    "    std::vector< NTA_UInt64 >::erase(std::vector< unsigned long >::iterator,std::vector< unsigned long >::iterator)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_new_VectorOfUInt64__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< unsigned long >::size_type arg1 ;
  std::vector< unsigned long >::value_type *arg2 = 0 ;
  size_t val1 ;
  int ecode1 = 0 ;
  std::vector< unsigned long >::value_type temp2 ;
  unsigned long val2 ;
  int ecode2 = 0 ;
  std::vector< NTA_UInt64 > *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_VectorOfUInt64" "', argument " "1"" of type '" "std::vector< unsigned long >::size_type""'");
  } 
  arg1 = static_cast< std::vector< unsigned long >::size_type >(val1);
  ecode2 = SWIG_AsVal_unsigned_SS_long(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_VectorOfUInt64" "', argument " "2"" of type '" "std::vector< unsigned long >::value_type""'");
  } 
  temp2 = static_cast< std::vector< unsigned long >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< NTA_UInt64 > *)new std::vector< NTA_UInt64 >(arg1,(std::vector< unsigned long >::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_unsigned_long_std__allocatorT_unsigned_long_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_VectorOfUInt64(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_VectorOfUInt64",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<unsigned long,std::allocator< unsigned long > >**)(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_unsigned_SS_long(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_VectorOfUInt64__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_VectorOfUInt64__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_new_VectorOfUInt64__SWIG_1(self, argc, argv);
    case 4:
      return _wrap_new_VectorOfUInt64__SWIG_3(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_VectorOfUInt64'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_UInt64 >::vector()\n"
    "    std::vector< NTA_UInt64 >::vector(std::vector< NTA_UInt64 > const &)\n"
    "    std::vector< NTA_UInt64 >::vector(std::vector< unsigned long >::size_type)\n"
    "    std::vector< NTA_UInt64 >::vector(std::vector< unsigned long >::size_type,std::vector< unsigned long >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt64_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 0 ;
  std::vector< unsigned long >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< unsigned long >::value_type temp2 ;
  unsigned long val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:VectorOfUInt64_push_back",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64_push_back" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_long(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfUInt64_push_back" "', argument " "2"" of type '" "std::vector< unsigned long >::value_type""'");
  } 
  temp2 = static_cast< std::vector< unsigned long >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->push_back((std::vector< unsigned long >::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_VectorOfUInt64_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< unsigned long >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64_front" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< unsigned long >::value_type *) &((std::vector< NTA_UInt64 > 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_unsigned_SS_long(static_cast< unsigned long >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt64_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< unsigned long >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64_back" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< unsigned long >::value_type *) &((std::vector< NTA_UInt64 > 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_unsigned_SS_long(static_cast< unsigned long >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt64_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 0 ;
  std::vector< unsigned long >::size_type arg2 ;
  std::vector< unsigned long >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  std::vector< unsigned long >::value_type temp3 ;
  unsigned long 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:VectorOfUInt64_assign",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64_assign" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfUInt64_assign" "', argument " "2"" of type '" "std::vector< unsigned long >::size_type""'");
  } 
  arg2 = static_cast< std::vector< unsigned long >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_long(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfUInt64_assign" "', argument " "3"" of type '" "std::vector< unsigned long >::value_type""'");
  } 
  temp3 = static_cast< std::vector< unsigned long >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->assign(arg2,(std::vector< unsigned long >::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_VectorOfUInt64_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 0 ;
  std::vector< unsigned long >::size_type arg2 ;
  std::vector< unsigned long >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  std::vector< unsigned long >::value_type temp3 ;
  unsigned long val3 ;
  int ecode3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64_resize" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfUInt64_resize" "', argument " "2"" of type '" "std::vector< unsigned long >::size_type""'");
  } 
  arg2 = static_cast< std::vector< unsigned long >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_long(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfUInt64_resize" "', argument " "3"" of type '" "std::vector< unsigned long >::value_type""'");
  } 
  temp3 = static_cast< std::vector< unsigned long >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resize(arg2,(std::vector< unsigned long >::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_VectorOfUInt64_resize(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfUInt64_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<unsigned long,std::allocator< unsigned long > >**)(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<unsigned long,std::allocator< unsigned long > >**)(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_unsigned_SS_long(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_VectorOfUInt64_resize__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfUInt64_resize__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfUInt64_resize'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_UInt64 >::resize(std::vector< unsigned long >::size_type)\n"
    "    std::vector< NTA_UInt64 >::resize(std::vector< unsigned long >::size_type,std::vector< unsigned long >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt64_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 0 ;
  SwigValueWrapper< std::vector< unsigned long >::iterator > arg2 ;
  std::vector< unsigned long >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  std::vector< unsigned long >::value_type temp3 ;
  unsigned long val3 ;
  int ecode3 = 0 ;
  SwigValueWrapper< std::vector< unsigned long >::iterator > result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64_insert" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(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 '" "VectorOfUInt64_insert" "', argument " "2"" of type '" "std::vector< unsigned long >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< unsigned long >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< unsigned long >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfUInt64_insert" "', argument " "2"" of type '" "std::vector< unsigned long >::iterator""'");
    }
  }
  ecode3 = SWIG_AsVal_unsigned_SS_long(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfUInt64_insert" "', argument " "3"" of type '" "std::vector< unsigned long >::value_type""'");
  } 
  temp3 = static_cast< std::vector< unsigned long >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_NTA_UInt64_Sg__insert__SWIG_0(arg1,arg2,(unsigned long 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< unsigned long >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt64_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 0 ;
  SwigValueWrapper< std::vector< unsigned long >::iterator > arg2 ;
  std::vector< unsigned long >::size_type arg3 ;
  std::vector< unsigned long >::value_type *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  size_t val3 ;
  int ecode3 = 0 ;
  std::vector< unsigned long >::value_type temp4 ;
  unsigned long val4 ;
  int ecode4 = 0 ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64_insert" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(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 '" "VectorOfUInt64_insert" "', argument " "2"" of type '" "std::vector< unsigned long >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< unsigned long >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< unsigned long >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfUInt64_insert" "', argument " "2"" of type '" "std::vector< unsigned long >::iterator""'");
    }
  }
  ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfUInt64_insert" "', argument " "3"" of type '" "std::vector< unsigned long >::size_type""'");
  } 
  arg3 = static_cast< std::vector< unsigned long >::size_type >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_long(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "VectorOfUInt64_insert" "', argument " "4"" of type '" "std::vector< unsigned long >::value_type""'");
  } 
  temp4 = static_cast< std::vector< unsigned long >::value_type >(val4);
  arg4 = &temp4;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_vector_Sl_NTA_UInt64_Sg__insert__SWIG_1(arg1,arg2,arg3,(unsigned long 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_VectorOfUInt64_insert(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfUInt64_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<unsigned long,std::allocator< unsigned long > >**)(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< unsigned long >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_long(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<unsigned long,std::allocator< unsigned long > >**)(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< unsigned long >::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_unsigned_SS_long(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_VectorOfUInt64_insert__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfUInt64_insert__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfUInt64_insert'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_UInt64 >::insert(std::vector< unsigned long >::iterator,std::vector< unsigned long >::value_type const &)\n"
    "    std::vector< NTA_UInt64 >::insert(std::vector< unsigned long >::iterator,std::vector< unsigned long >::size_type,std::vector< unsigned long >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfUInt64_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 0 ;
  std::vector< unsigned long >::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:VectorOfUInt64_reserve",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64_reserve" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfUInt64_reserve" "', argument " "2"" of type '" "std::vector< unsigned long >::size_type""'");
  } 
  arg2 = static_cast< std::vector< unsigned long >::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_VectorOfUInt64_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< unsigned long >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfUInt64_capacity" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< NTA_UInt64 > 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_VectorOfUInt64(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_UInt64 > *arg1 = (std::vector< NTA_UInt64 > *) 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_unsigned_long_std__allocatorT_unsigned_long_t_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_VectorOfUInt64" "', argument " "1"" of type '" "std::vector< NTA_UInt64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_UInt64 > * >(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 *VectorOfUInt64_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_unsigned_long_std__allocatorT_unsigned_long_t_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_FloatVector_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 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_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector_iterator" "', argument " "1"" of type '" "std::vector< NTA_Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (swig::SwigPyIterator *)std_vector_Sl_NTA_Real32_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_FloatVector___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 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_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector___nonzero__" "', argument " "1"" of type '" "std::vector< NTA_Real32 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_vector_Sl_NTA_Real32_Sg____nonzero__((std::vector< float > 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_FloatVector___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 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_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector___bool__" "', argument " "1"" of type '" "std::vector< NTA_Real32 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_vector_Sl_NTA_Real32_Sg____bool__((std::vector< float > 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_FloatVector___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< float >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector___len__" "', argument " "1"" of type '" "std::vector< NTA_Real32 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_NTA_Real32_Sg____len__((std::vector< float > 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_FloatVector_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< float >::value_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector_pop" "', argument " "1"" of type '" "std::vector< NTA_Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< float >::value_type)std_vector_Sl_NTA_Real32_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_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_FloatVector___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 0 ;
  std::vector< float >::difference_type arg2 ;
  std::vector< float >::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< float,std::allocator< float > > *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:FloatVector___getslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector___getslice__" "', argument " "1"" of type '" "std::vector< NTA_Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FloatVector___getslice__" "', argument " "2"" of type '" "std::vector< float >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< float >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "FloatVector___getslice__" "', argument " "3"" of type '" "std::vector< float >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< float >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< float,std::allocator< float > > *)std_vector_Sl_NTA_Real32_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_float_std__allocatorT_float_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_FloatVector___setslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 0 ;
  std::vector< float >::difference_type arg2 ;
  std::vector< float >::difference_type arg3 ;
  std::vector< float,std::allocator< float > > const &arg4_defvalue = std::vector< float,std::allocator< float > >() ;
  std::vector< float,std::allocator< float > > *arg4 = (std::vector< float,std::allocator< float > > *) &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:FloatVector___setslice__",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector___setslice__" "', argument " "1"" of type '" "std::vector< NTA_Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FloatVector___setslice__" "', argument " "2"" of type '" "std::vector< float >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< float >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "FloatVector___setslice__" "', argument " "3"" of type '" "std::vector< float >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< float >::difference_type >(val3);
  if (obj3) {
    {
      std::vector<float,std::allocator< float > > *ptr = (std::vector<float,std::allocator< float > > *)0;
      res4 = swig::asptr(obj3, &ptr);
      if (!SWIG_IsOK(res4)) {
        SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "FloatVector___setslice__" "', argument " "4"" of type '" "std::vector< float,std::allocator< float > > const &""'"); 
      }
      if (!ptr) {
        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FloatVector___setslice__" "', argument " "4"" of type '" "std::vector< float,std::allocator< float > > const &""'"); 
      }
      arg4 = ptr;
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_NTA_Real32_Sg____setslice__(arg1,arg2,arg3,(std::vector< float,std::allocator< float > > 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_FloatVector___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 0 ;
  std::vector< float >::difference_type arg2 ;
  std::vector< float >::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:FloatVector___delslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector___delslice__" "', argument " "1"" of type '" "std::vector< NTA_Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FloatVector___delslice__" "', argument " "2"" of type '" "std::vector< float >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< float >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "FloatVector___delslice__" "', argument " "3"" of type '" "std::vector< float >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< float >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_NTA_Real32_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_FloatVector___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 0 ;
  std::vector< float >::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_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector___delitem__" "', argument " "1"" of type '" "std::vector< NTA_Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FloatVector___delitem__" "', argument " "2"" of type '" "std::vector< float >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< float >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_NTA_Real32_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_FloatVector___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< float,std::allocator< float > > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector___getitem__" "', argument " "1"" of type '" "std::vector< NTA_Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "FloatVector___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< float,std::allocator< float > > *)std_vector_Sl_NTA_Real32_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_float_std__allocatorT_float_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_FloatVector___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  std::vector< float,std::allocator< float > > *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_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector___setitem__" "', argument " "1"" of type '" "std::vector< NTA_Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "FloatVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    std::vector<float,std::allocator< float > > *ptr = (std::vector<float,std::allocator< float > > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "FloatVector___setitem__" "', argument " "3"" of type '" "std::vector< float,std::allocator< float > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FloatVector___setitem__" "', argument " "3"" of type '" "std::vector< float,std::allocator< float > > const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_NTA_Real32_Sg____setitem____SWIG_0(arg1,arg2,(std::vector< float,std::allocator< float > > 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_FloatVector___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 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_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector___setitem__" "', argument " "1"" of type '" "std::vector< NTA_Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "FloatVector___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_NTA_Real32_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_FloatVector___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 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_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector___delitem__" "', argument " "1"" of type '" "std::vector< NTA_Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "FloatVector___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_NTA_Real32_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_FloatVector___delitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"FloatVector___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<float,std::allocator< float > >**)(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<float,std::allocator< float > >**)(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_FloatVector___delitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_FloatVector___delitem____SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'FloatVector___delitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_Real32 >::__delitem__(std::vector< float >::difference_type)\n"
    "    std::vector< NTA_Real32 >::__delitem__(PySliceObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_FloatVector___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 0 ;
  std::vector< float >::difference_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  std::vector< float >::value_type *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector___getitem__" "', argument " "1"" of type '" "std::vector< NTA_Real32 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FloatVector___getitem__" "', argument " "2"" of type '" "std::vector< float >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< float >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< float >::value_type *) &std_vector_Sl_NTA_Real32_Sg____getitem____SWIG_1((std::vector< float > 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_float(static_cast< float >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_FloatVector___getitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"FloatVector___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<float,std::allocator< float > >**)(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<float,std::allocator< float > >**)(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_FloatVector___getitem____SWIG_0(self, argc, argv);
    case 2:
      return _wrap_FloatVector___getitem____SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'FloatVector___getitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_Real32 >::__getitem__(PySliceObject *)\n"
    "    std::vector< NTA_Real32 >::__getitem__(std::vector< float >::difference_type) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_FloatVector___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 0 ;
  std::vector< float >::difference_type arg2 ;
  std::vector< float >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  std::vector< float >::value_type temp3 ;
  float val3 ;
  int ecode3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector___setitem__" "', argument " "1"" of type '" "std::vector< NTA_Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FloatVector___setitem__" "', argument " "2"" of type '" "std::vector< float >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< float >::difference_type >(val2);
  ecode3 = SWIG_AsVal_float(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "FloatVector___setitem__" "', argument " "3"" of type '" "std::vector< float >::value_type""'");
  } 
  temp3 = static_cast< std::vector< float >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_NTA_Real32_Sg____setitem____SWIG_2(arg1,arg2,(float 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_FloatVector___setitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"FloatVector___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<float,std::allocator< float > >**)(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<float,std::allocator< float > >**)(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<float,std::allocator< 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:
    
    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<float,std::allocator< float > >**)(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_float(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_FloatVector___setitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_FloatVector___setitem____SWIG_0(self, argc, argv);
    case 3:
      return _wrap_FloatVector___setitem____SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'FloatVector___setitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_Real32 >::__setitem__(PySliceObject *,std::vector< float,std::allocator< float > > const &)\n"
    "    std::vector< NTA_Real32 >::__setitem__(PySliceObject *)\n"
    "    std::vector< NTA_Real32 >::__setitem__(std::vector< float >::difference_type,std::vector< float >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_FloatVector_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 0 ;
  std::vector< float >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< float >::value_type temp2 ;
  float val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:FloatVector_append",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector_append" "', argument " "1"" of type '" "std::vector< NTA_Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(argp1);
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FloatVector_append" "', argument " "2"" of type '" "std::vector< float >::value_type""'");
  } 
  temp2 = static_cast< std::vector< float >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_vector_Sl_NTA_Real32_Sg__append(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_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_FloatVector__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *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< NTA_Real32 > *)new std::vector< NTA_Real32 >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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_float_std__allocatorT_float_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_FloatVector__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  std::vector< NTA_Real32 > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  {
    std::vector<float,std::allocator< float > > *ptr = (std::vector<float,std::allocator< float > > *)0;
    res1 = swig::asptr(swig_obj[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_FloatVector" "', argument " "1"" of type '" "std::vector< NTA_Real32 > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_FloatVector" "', argument " "1"" of type '" "std::vector< NTA_Real32 > const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< NTA_Real32 > *)new std::vector< NTA_Real32 >((std::vector< NTA_Real32 > 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_float_std__allocatorT_float_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_FloatVector_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 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_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector_empty" "', argument " "1"" of type '" "std::vector< NTA_Real32 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((std::vector< NTA_Real32 > 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_FloatVector_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< float >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector_size" "', argument " "1"" of type '" "std::vector< NTA_Real32 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< NTA_Real32 > 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_FloatVector_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 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_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector_clear" "', argument " "1"" of type '" "std::vector< NTA_Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(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_FloatVector_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 0 ;
  std::vector< NTA_Real32 > *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:FloatVector_swap",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector_swap" "', argument " "1"" of type '" "std::vector< NTA_Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(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 '" "FloatVector_swap" "', argument " "2"" of type '" "std::vector< NTA_Real32 > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FloatVector_swap" "', argument " "2"" of type '" "std::vector< NTA_Real32 > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< NTA_Real32 > * >(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_FloatVector_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::allocator< float > > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector_get_allocator" "', argument " "1"" of type '" "std::vector< NTA_Real32 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< NTA_Real32 > 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< float >::allocator_type(static_cast< const std::vector< float >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_float_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_FloatVector_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< float >::iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector_begin" "', argument " "1"" of type '" "std::vector< NTA_Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(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< float >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_FloatVector_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< float >::iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector_end" "', argument " "1"" of type '" "std::vector< NTA_Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(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< float >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_FloatVector_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< float >::reverse_iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector_rbegin" "', argument " "1"" of type '" "std::vector< NTA_Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(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< float >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_FloatVector_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< float >::reverse_iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector_rend" "', argument " "1"" of type '" "std::vector< NTA_Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(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< float >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_FloatVector__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< float >::size_type arg1 ;
  size_t val1 ;
  int ecode1 = 0 ;
  std::vector< NTA_Real32 > *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_FloatVector" "', argument " "1"" of type '" "std::vector< float >::size_type""'");
  } 
  arg1 = static_cast< std::vector< float >::size_type >(val1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< NTA_Real32 > *)new std::vector< NTA_Real32 >(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_float_std__allocatorT_float_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_FloatVector_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 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_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector_pop_back" "', argument " "1"" of type '" "std::vector< NTA_Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(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_FloatVector_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 0 ;
  std::vector< float >::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_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector_resize" "', argument " "1"" of type '" "std::vector< NTA_Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FloatVector_resize" "', argument " "2"" of type '" "std::vector< float >::size_type""'");
  } 
  arg2 = static_cast< std::vector< float >::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_FloatVector_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 0 ;
  SwigValueWrapper< std::vector< float >::iterator > arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  SwigValueWrapper< std::vector< float >::iterator > result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector_erase" "', argument " "1"" of type '" "std::vector< NTA_Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(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 '" "FloatVector_erase" "', argument " "2"" of type '" "std::vector< float >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< float >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< float >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "FloatVector_erase" "', argument " "2"" of type '" "std::vector< float >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_NTA_Real32_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< float >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_FloatVector_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 0 ;
  SwigValueWrapper< std::vector< float >::iterator > arg2 ;
  SwigValueWrapper< std::vector< float >::iterator > arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  swig::SwigPyIterator *iter3 = 0 ;
  int res3 ;
  SwigValueWrapper< std::vector< float >::iterator > result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector_erase" "', argument " "1"" of type '" "std::vector< NTA_Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(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 '" "FloatVector_erase" "', argument " "2"" of type '" "std::vector< float >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< float >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< float >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "FloatVector_erase" "', argument " "2"" of type '" "std::vector< float >::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 '" "FloatVector_erase" "', argument " "3"" of type '" "std::vector< float >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< float >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< float >::iterator > *>(iter3);
    if (iter_t) {
      arg3 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "FloatVector_erase" "', argument " "3"" of type '" "std::vector< float >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_NTA_Real32_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< float >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_FloatVector_erase(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"FloatVector_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<float,std::allocator< float > >**)(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< float >::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<float,std::allocator< float > >**)(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< float >::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< float >::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_FloatVector_erase__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_FloatVector_erase__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'FloatVector_erase'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_Real32 >::erase(std::vector< float >::iterator)\n"
    "    std::vector< NTA_Real32 >::erase(std::vector< float >::iterator,std::vector< float >::iterator)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_new_FloatVector__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< float >::size_type arg1 ;
  std::vector< float >::value_type *arg2 = 0 ;
  size_t val1 ;
  int ecode1 = 0 ;
  std::vector< float >::value_type temp2 ;
  float val2 ;
  int ecode2 = 0 ;
  std::vector< NTA_Real32 > *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_FloatVector" "', argument " "1"" of type '" "std::vector< float >::size_type""'");
  } 
  arg1 = static_cast< std::vector< float >::size_type >(val1);
  ecode2 = SWIG_AsVal_float(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_FloatVector" "', argument " "2"" of type '" "std::vector< float >::value_type""'");
  } 
  temp2 = static_cast< std::vector< float >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< NTA_Real32 > *)new std::vector< NTA_Real32 >(arg1,(std::vector< float >::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_float_std__allocatorT_float_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_FloatVector(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_FloatVector",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<float,std::allocator< float > >**)(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_float(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_FloatVector__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_FloatVector__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_new_FloatVector__SWIG_1(self, argc, argv);
    case 4:
      return _wrap_new_FloatVector__SWIG_3(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_FloatVector'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_Real32 >::vector()\n"
    "    std::vector< NTA_Real32 >::vector(std::vector< NTA_Real32 > const &)\n"
    "    std::vector< NTA_Real32 >::vector(std::vector< float >::size_type)\n"
    "    std::vector< NTA_Real32 >::vector(std::vector< float >::size_type,std::vector< float >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_FloatVector_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 0 ;
  std::vector< float >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< float >::value_type temp2 ;
  float val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:FloatVector_push_back",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector_push_back" "', argument " "1"" of type '" "std::vector< NTA_Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(argp1);
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FloatVector_push_back" "', argument " "2"" of type '" "std::vector< float >::value_type""'");
  } 
  temp2 = static_cast< std::vector< float >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->push_back((std::vector< float >::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_FloatVector_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< float >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector_front" "', argument " "1"" of type '" "std::vector< NTA_Real32 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< float >::value_type *) &((std::vector< NTA_Real32 > 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_float(static_cast< float >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_FloatVector_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< float >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector_back" "', argument " "1"" of type '" "std::vector< NTA_Real32 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< float >::value_type *) &((std::vector< NTA_Real32 > 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_float(static_cast< float >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_FloatVector_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 0 ;
  std::vector< float >::size_type arg2 ;
  std::vector< float >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  std::vector< float >::value_type temp3 ;
  float 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:FloatVector_assign",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector_assign" "', argument " "1"" of type '" "std::vector< NTA_Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FloatVector_assign" "', argument " "2"" of type '" "std::vector< float >::size_type""'");
  } 
  arg2 = static_cast< std::vector< float >::size_type >(val2);
  ecode3 = SWIG_AsVal_float(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "FloatVector_assign" "', argument " "3"" of type '" "std::vector< float >::value_type""'");
  } 
  temp3 = static_cast< std::vector< float >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->assign(arg2,(std::vector< float >::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_FloatVector_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 0 ;
  std::vector< float >::size_type arg2 ;
  std::vector< float >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  std::vector< float >::value_type temp3 ;
  float val3 ;
  int ecode3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector_resize" "', argument " "1"" of type '" "std::vector< NTA_Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FloatVector_resize" "', argument " "2"" of type '" "std::vector< float >::size_type""'");
  } 
  arg2 = static_cast< std::vector< float >::size_type >(val2);
  ecode3 = SWIG_AsVal_float(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "FloatVector_resize" "', argument " "3"" of type '" "std::vector< float >::value_type""'");
  } 
  temp3 = static_cast< std::vector< float >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resize(arg2,(std::vector< float >::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_FloatVector_resize(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"FloatVector_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<float,std::allocator< 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[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<float,std::allocator< float > >**)(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_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:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_FloatVector_resize__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_FloatVector_resize__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'FloatVector_resize'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_Real32 >::resize(std::vector< float >::size_type)\n"
    "    std::vector< NTA_Real32 >::resize(std::vector< float >::size_type,std::vector< float >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_FloatVector_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 0 ;
  SwigValueWrapper< std::vector< float >::iterator > arg2 ;
  std::vector< float >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  std::vector< float >::value_type temp3 ;
  float val3 ;
  int ecode3 = 0 ;
  SwigValueWrapper< std::vector< float >::iterator > result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector_insert" "', argument " "1"" of type '" "std::vector< NTA_Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(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 '" "FloatVector_insert" "', argument " "2"" of type '" "std::vector< float >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< float >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< float >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "FloatVector_insert" "', argument " "2"" of type '" "std::vector< float >::iterator""'");
    }
  }
  ecode3 = SWIG_AsVal_float(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "FloatVector_insert" "', argument " "3"" of type '" "std::vector< float >::value_type""'");
  } 
  temp3 = static_cast< std::vector< float >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_NTA_Real32_Sg__insert__SWIG_0(arg1,arg2,(float 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< float >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_FloatVector_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 0 ;
  SwigValueWrapper< std::vector< float >::iterator > arg2 ;
  std::vector< float >::size_type arg3 ;
  std::vector< float >::value_type *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  size_t val3 ;
  int ecode3 = 0 ;
  std::vector< float >::value_type temp4 ;
  float val4 ;
  int ecode4 = 0 ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector_insert" "', argument " "1"" of type '" "std::vector< NTA_Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(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 '" "FloatVector_insert" "', argument " "2"" of type '" "std::vector< float >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< float >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< float >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "FloatVector_insert" "', argument " "2"" of type '" "std::vector< float >::iterator""'");
    }
  }
  ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "FloatVector_insert" "', argument " "3"" of type '" "std::vector< float >::size_type""'");
  } 
  arg3 = static_cast< std::vector< float >::size_type >(val3);
  ecode4 = SWIG_AsVal_float(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "FloatVector_insert" "', argument " "4"" of type '" "std::vector< float >::value_type""'");
  } 
  temp4 = static_cast< std::vector< float >::value_type >(val4);
  arg4 = &temp4;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_vector_Sl_NTA_Real32_Sg__insert__SWIG_1(arg1,arg2,arg3,(float 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_FloatVector_insert(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"FloatVector_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<float,std::allocator< float > >**)(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< float >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_float(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<float,std::allocator< float > >**)(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< float >::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_float(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_FloatVector_insert__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_FloatVector_insert__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'FloatVector_insert'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_Real32 >::insert(std::vector< float >::iterator,std::vector< float >::value_type const &)\n"
    "    std::vector< NTA_Real32 >::insert(std::vector< float >::iterator,std::vector< float >::size_type,std::vector< float >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_FloatVector_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 0 ;
  std::vector< float >::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:FloatVector_reserve",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector_reserve" "', argument " "1"" of type '" "std::vector< NTA_Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FloatVector_reserve" "', argument " "2"" of type '" "std::vector< float >::size_type""'");
  } 
  arg2 = static_cast< std::vector< float >::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_FloatVector_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< float >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FloatVector_capacity" "', argument " "1"" of type '" "std::vector< NTA_Real32 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< NTA_Real32 > 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_FloatVector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real32 > *arg1 = (std::vector< NTA_Real32 > *) 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_float_std__allocatorT_float_t_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_FloatVector" "', argument " "1"" of type '" "std::vector< NTA_Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real32 > * >(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 *FloatVector_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_float_std__allocatorT_float_t_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_DoubleVector_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 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_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_iterator" "', argument " "1"" of type '" "std::vector< NTA_Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (swig::SwigPyIterator *)std_vector_Sl_NTA_Real64_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_DoubleVector___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 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_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___nonzero__" "', argument " "1"" of type '" "std::vector< NTA_Real64 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_vector_Sl_NTA_Real64_Sg____nonzero__((std::vector< double > 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_DoubleVector___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 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_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___bool__" "', argument " "1"" of type '" "std::vector< NTA_Real64 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_vector_Sl_NTA_Real64_Sg____bool__((std::vector< double > 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_DoubleVector___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< double >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___len__" "', argument " "1"" of type '" "std::vector< NTA_Real64 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_NTA_Real64_Sg____len__((std::vector< double > 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_DoubleVector_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< double >::value_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_pop" "', argument " "1"" of type '" "std::vector< NTA_Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< double >::value_type)std_vector_Sl_NTA_Real64_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_double(static_cast< double >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_DoubleVector___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 0 ;
  std::vector< double >::difference_type arg2 ;
  std::vector< double >::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< double,std::allocator< double > > *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:DoubleVector___getslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___getslice__" "', argument " "1"" of type '" "std::vector< NTA_Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___getslice__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< double >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector___getslice__" "', argument " "3"" of type '" "std::vector< double >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< double >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< double,std::allocator< double > > *)std_vector_Sl_NTA_Real64_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_double_std__allocatorT_double_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_DoubleVector___setslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 0 ;
  std::vector< double >::difference_type arg2 ;
  std::vector< double >::difference_type arg3 ;
  std::vector< double,std::allocator< double > > const &arg4_defvalue = std::vector< double,std::allocator< double > >() ;
  std::vector< double,std::allocator< double > > *arg4 = (std::vector< double,std::allocator< double > > *) &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:DoubleVector___setslice__",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___setslice__" "', argument " "1"" of type '" "std::vector< NTA_Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___setslice__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< double >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector___setslice__" "', argument " "3"" of type '" "std::vector< double >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< double >::difference_type >(val3);
  if (obj3) {
    {
      std::vector<double,std::allocator< double > > *ptr = (std::vector<double,std::allocator< double > > *)0;
      res4 = swig::asptr(obj3, &ptr);
      if (!SWIG_IsOK(res4)) {
        SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "DoubleVector___setslice__" "', argument " "4"" of type '" "std::vector< double,std::allocator< double > > const &""'"); 
      }
      if (!ptr) {
        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleVector___setslice__" "', argument " "4"" of type '" "std::vector< double,std::allocator< double > > const &""'"); 
      }
      arg4 = ptr;
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_NTA_Real64_Sg____setslice__(arg1,arg2,arg3,(std::vector< double,std::allocator< double > > 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_DoubleVector___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 0 ;
  std::vector< double >::difference_type arg2 ;
  std::vector< double >::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:DoubleVector___delslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___delslice__" "', argument " "1"" of type '" "std::vector< NTA_Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___delslice__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< double >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector___delslice__" "', argument " "3"" of type '" "std::vector< double >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< double >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_NTA_Real64_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_DoubleVector___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 0 ;
  std::vector< double >::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_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___delitem__" "', argument " "1"" of type '" "std::vector< NTA_Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___delitem__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< double >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_NTA_Real64_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_DoubleVector___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< double,std::allocator< double > > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___getitem__" "', argument " "1"" of type '" "std::vector< NTA_Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector___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< double,std::allocator< double > > *)std_vector_Sl_NTA_Real64_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_double_std__allocatorT_double_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_DoubleVector___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  std::vector< double,std::allocator< double > > *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_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___setitem__" "', argument " "1"" of type '" "std::vector< NTA_Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    std::vector<double,std::allocator< double > > *ptr = (std::vector<double,std::allocator< double > > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "DoubleVector___setitem__" "', argument " "3"" of type '" "std::vector< double,std::allocator< double > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleVector___setitem__" "', argument " "3"" of type '" "std::vector< double,std::allocator< double > > const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_NTA_Real64_Sg____setitem____SWIG_0(arg1,arg2,(std::vector< double,std::allocator< double > > 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_DoubleVector___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 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_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___setitem__" "', argument " "1"" of type '" "std::vector< NTA_Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector___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_NTA_Real64_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_DoubleVector___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 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_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___delitem__" "', argument " "1"" of type '" "std::vector< NTA_Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector___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_NTA_Real64_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_DoubleVector___delitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"DoubleVector___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<double,std::allocator< double > >**)(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<double,std::allocator< double > >**)(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_DoubleVector___delitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_DoubleVector___delitem____SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'DoubleVector___delitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_Real64 >::__delitem__(std::vector< double >::difference_type)\n"
    "    std::vector< NTA_Real64 >::__delitem__(PySliceObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_DoubleVector___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 0 ;
  std::vector< double >::difference_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  std::vector< double >::value_type *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___getitem__" "', argument " "1"" of type '" "std::vector< NTA_Real64 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___getitem__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< double >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< double >::value_type *) &std_vector_Sl_NTA_Real64_Sg____getitem____SWIG_1((std::vector< double > 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_double(static_cast< double >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_DoubleVector___getitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"DoubleVector___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<double,std::allocator< double > >**)(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<double,std::allocator< double > >**)(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_DoubleVector___getitem____SWIG_0(self, argc, argv);
    case 2:
      return _wrap_DoubleVector___getitem____SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'DoubleVector___getitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_Real64 >::__getitem__(PySliceObject *)\n"
    "    std::vector< NTA_Real64 >::__getitem__(std::vector< double >::difference_type) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_DoubleVector___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 0 ;
  std::vector< double >::difference_type arg2 ;
  std::vector< double >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  std::vector< double >::value_type temp3 ;
  double val3 ;
  int ecode3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___setitem__" "', argument " "1"" of type '" "std::vector< NTA_Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___setitem__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< double >::difference_type >(val2);
  ecode3 = SWIG_AsVal_double(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector___setitem__" "', argument " "3"" of type '" "std::vector< double >::value_type""'");
  } 
  temp3 = static_cast< std::vector< double >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_NTA_Real64_Sg____setitem____SWIG_2(arg1,arg2,(double 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_DoubleVector___setitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"DoubleVector___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<double,std::allocator< double > >**)(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<double,std::allocator< double > >**)(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<double,std::allocator< double > >**)(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<double,std::allocator< double > >**)(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_double(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_DoubleVector___setitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_DoubleVector___setitem____SWIG_0(self, argc, argv);
    case 3:
      return _wrap_DoubleVector___setitem____SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'DoubleVector___setitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_Real64 >::__setitem__(PySliceObject *,std::vector< double,std::allocator< double > > const &)\n"
    "    std::vector< NTA_Real64 >::__setitem__(PySliceObject *)\n"
    "    std::vector< NTA_Real64 >::__setitem__(std::vector< double >::difference_type,std::vector< double >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_DoubleVector_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 0 ;
  std::vector< double >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< double >::value_type temp2 ;
  double val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:DoubleVector_append",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_append" "', argument " "1"" of type '" "std::vector< NTA_Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(argp1);
  ecode2 = SWIG_AsVal_double(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector_append" "', argument " "2"" of type '" "std::vector< double >::value_type""'");
  } 
  temp2 = static_cast< std::vector< double >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_vector_Sl_NTA_Real64_Sg__append(arg1,(double 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_DoubleVector__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *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< NTA_Real64 > *)new std::vector< NTA_Real64 >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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_double_std__allocatorT_double_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_DoubleVector__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  std::vector< NTA_Real64 > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  {
    std::vector<double,std::allocator< double > > *ptr = (std::vector<double,std::allocator< double > > *)0;
    res1 = swig::asptr(swig_obj[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_DoubleVector" "', argument " "1"" of type '" "std::vector< NTA_Real64 > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_DoubleVector" "', argument " "1"" of type '" "std::vector< NTA_Real64 > const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< NTA_Real64 > *)new std::vector< NTA_Real64 >((std::vector< NTA_Real64 > 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_double_std__allocatorT_double_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_DoubleVector_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 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_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_empty" "', argument " "1"" of type '" "std::vector< NTA_Real64 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((std::vector< NTA_Real64 > 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_DoubleVector_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< double >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_size" "', argument " "1"" of type '" "std::vector< NTA_Real64 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< NTA_Real64 > 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_DoubleVector_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 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_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_clear" "', argument " "1"" of type '" "std::vector< NTA_Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(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_DoubleVector_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 0 ;
  std::vector< NTA_Real64 > *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:DoubleVector_swap",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_swap" "', argument " "1"" of type '" "std::vector< NTA_Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DoubleVector_swap" "', argument " "2"" of type '" "std::vector< NTA_Real64 > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleVector_swap" "', argument " "2"" of type '" "std::vector< NTA_Real64 > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< NTA_Real64 > * >(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_DoubleVector_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::allocator< double > > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_get_allocator" "', argument " "1"" of type '" "std::vector< NTA_Real64 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< NTA_Real64 > 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< double >::allocator_type(static_cast< const std::vector< double >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_double_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_DoubleVector_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< double >::iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_begin" "', argument " "1"" of type '" "std::vector< NTA_Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(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< double >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_DoubleVector_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< double >::iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_end" "', argument " "1"" of type '" "std::vector< NTA_Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(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< double >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_DoubleVector_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< double >::reverse_iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_rbegin" "', argument " "1"" of type '" "std::vector< NTA_Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(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< double >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_DoubleVector_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< double >::reverse_iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_rend" "', argument " "1"" of type '" "std::vector< NTA_Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(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< double >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_DoubleVector__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< double >::size_type arg1 ;
  size_t val1 ;
  int ecode1 = 0 ;
  std::vector< NTA_Real64 > *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_DoubleVector" "', argument " "1"" of type '" "std::vector< double >::size_type""'");
  } 
  arg1 = static_cast< std::vector< double >::size_type >(val1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< NTA_Real64 > *)new std::vector< NTA_Real64 >(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_double_std__allocatorT_double_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_DoubleVector_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 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_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_pop_back" "', argument " "1"" of type '" "std::vector< NTA_Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(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_DoubleVector_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 0 ;
  std::vector< double >::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_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_resize" "', argument " "1"" of type '" "std::vector< NTA_Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector_resize" "', argument " "2"" of type '" "std::vector< double >::size_type""'");
  } 
  arg2 = static_cast< std::vector< double >::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_DoubleVector_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 0 ;
  SwigValueWrapper< std::vector< double >::iterator > arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  SwigValueWrapper< std::vector< double >::iterator > result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_erase" "', argument " "1"" of type '" "std::vector< NTA_Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(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 '" "DoubleVector_erase" "', argument " "2"" of type '" "std::vector< double >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< double >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_erase" "', argument " "2"" of type '" "std::vector< double >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_NTA_Real64_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< double >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_DoubleVector_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 0 ;
  SwigValueWrapper< std::vector< double >::iterator > arg2 ;
  SwigValueWrapper< std::vector< double >::iterator > arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  swig::SwigPyIterator *iter3 = 0 ;
  int res3 ;
  SwigValueWrapper< std::vector< double >::iterator > result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_erase" "', argument " "1"" of type '" "std::vector< NTA_Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(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 '" "DoubleVector_erase" "', argument " "2"" of type '" "std::vector< double >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< double >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_erase" "', argument " "2"" of type '" "std::vector< double >::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 '" "DoubleVector_erase" "', argument " "3"" of type '" "std::vector< double >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< double >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter3);
    if (iter_t) {
      arg3 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_erase" "', argument " "3"" of type '" "std::vector< double >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_NTA_Real64_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< double >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_DoubleVector_erase(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"DoubleVector_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<double,std::allocator< double > >**)(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< double >::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<double,std::allocator< double > >**)(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< double >::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< double >::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_DoubleVector_erase__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_DoubleVector_erase__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'DoubleVector_erase'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_Real64 >::erase(std::vector< double >::iterator)\n"
    "    std::vector< NTA_Real64 >::erase(std::vector< double >::iterator,std::vector< double >::iterator)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_new_DoubleVector__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< double >::size_type arg1 ;
  std::vector< double >::value_type *arg2 = 0 ;
  size_t val1 ;
  int ecode1 = 0 ;
  std::vector< double >::value_type temp2 ;
  double val2 ;
  int ecode2 = 0 ;
  std::vector< NTA_Real64 > *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_DoubleVector" "', argument " "1"" of type '" "std::vector< double >::size_type""'");
  } 
  arg1 = static_cast< std::vector< double >::size_type >(val1);
  ecode2 = SWIG_AsVal_double(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_DoubleVector" "', argument " "2"" of type '" "std::vector< double >::value_type""'");
  } 
  temp2 = static_cast< std::vector< double >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< NTA_Real64 > *)new std::vector< NTA_Real64 >(arg1,(std::vector< double >::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_double_std__allocatorT_double_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_DoubleVector(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_DoubleVector",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<double,std::allocator< double > >**)(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_double(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_DoubleVector__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_DoubleVector__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_new_DoubleVector__SWIG_1(self, argc, argv);
    case 4:
      return _wrap_new_DoubleVector__SWIG_3(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_DoubleVector'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_Real64 >::vector()\n"
    "    std::vector< NTA_Real64 >::vector(std::vector< NTA_Real64 > const &)\n"
    "    std::vector< NTA_Real64 >::vector(std::vector< double >::size_type)\n"
    "    std::vector< NTA_Real64 >::vector(std::vector< double >::size_type,std::vector< double >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_DoubleVector_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 0 ;
  std::vector< double >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< double >::value_type temp2 ;
  double val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:DoubleVector_push_back",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_push_back" "', argument " "1"" of type '" "std::vector< NTA_Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(argp1);
  ecode2 = SWIG_AsVal_double(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector_push_back" "', argument " "2"" of type '" "std::vector< double >::value_type""'");
  } 
  temp2 = static_cast< std::vector< double >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->push_back((std::vector< double >::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_DoubleVector_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< double >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_front" "', argument " "1"" of type '" "std::vector< NTA_Real64 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< double >::value_type *) &((std::vector< NTA_Real64 > 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_double(static_cast< double >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_DoubleVector_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< double >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_back" "', argument " "1"" of type '" "std::vector< NTA_Real64 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< double >::value_type *) &((std::vector< NTA_Real64 > 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_double(static_cast< double >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_DoubleVector_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 0 ;
  std::vector< double >::size_type arg2 ;
  std::vector< double >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  std::vector< double >::value_type temp3 ;
  double 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:DoubleVector_assign",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_assign" "', argument " "1"" of type '" "std::vector< NTA_Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector_assign" "', argument " "2"" of type '" "std::vector< double >::size_type""'");
  } 
  arg2 = static_cast< std::vector< double >::size_type >(val2);
  ecode3 = SWIG_AsVal_double(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector_assign" "', argument " "3"" of type '" "std::vector< double >::value_type""'");
  } 
  temp3 = static_cast< std::vector< double >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->assign(arg2,(std::vector< double >::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_DoubleVector_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 0 ;
  std::vector< double >::size_type arg2 ;
  std::vector< double >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  std::vector< double >::value_type temp3 ;
  double val3 ;
  int ecode3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_resize" "', argument " "1"" of type '" "std::vector< NTA_Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector_resize" "', argument " "2"" of type '" "std::vector< double >::size_type""'");
  } 
  arg2 = static_cast< std::vector< double >::size_type >(val2);
  ecode3 = SWIG_AsVal_double(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector_resize" "', argument " "3"" of type '" "std::vector< double >::value_type""'");
  } 
  temp3 = static_cast< std::vector< double >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resize(arg2,(std::vector< double >::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_DoubleVector_resize(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"DoubleVector_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<double,std::allocator< double > >**)(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<double,std::allocator< double > >**)(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_double(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_DoubleVector_resize__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_DoubleVector_resize__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'DoubleVector_resize'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_Real64 >::resize(std::vector< double >::size_type)\n"
    "    std::vector< NTA_Real64 >::resize(std::vector< double >::size_type,std::vector< double >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_DoubleVector_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 0 ;
  SwigValueWrapper< std::vector< double >::iterator > arg2 ;
  std::vector< double >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  std::vector< double >::value_type temp3 ;
  double val3 ;
  int ecode3 = 0 ;
  SwigValueWrapper< std::vector< double >::iterator > result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_insert" "', argument " "1"" of type '" "std::vector< NTA_Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(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 '" "DoubleVector_insert" "', argument " "2"" of type '" "std::vector< double >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< double >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_insert" "', argument " "2"" of type '" "std::vector< double >::iterator""'");
    }
  }
  ecode3 = SWIG_AsVal_double(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector_insert" "', argument " "3"" of type '" "std::vector< double >::value_type""'");
  } 
  temp3 = static_cast< std::vector< double >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_NTA_Real64_Sg__insert__SWIG_0(arg1,arg2,(double 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< double >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_DoubleVector_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 0 ;
  SwigValueWrapper< std::vector< double >::iterator > arg2 ;
  std::vector< double >::size_type arg3 ;
  std::vector< double >::value_type *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  size_t val3 ;
  int ecode3 = 0 ;
  std::vector< double >::value_type temp4 ;
  double val4 ;
  int ecode4 = 0 ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_insert" "', argument " "1"" of type '" "std::vector< NTA_Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(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 '" "DoubleVector_insert" "', argument " "2"" of type '" "std::vector< double >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< double >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_insert" "', argument " "2"" of type '" "std::vector< double >::iterator""'");
    }
  }
  ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector_insert" "', argument " "3"" of type '" "std::vector< double >::size_type""'");
  } 
  arg3 = static_cast< std::vector< double >::size_type >(val3);
  ecode4 = SWIG_AsVal_double(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "DoubleVector_insert" "', argument " "4"" of type '" "std::vector< double >::value_type""'");
  } 
  temp4 = static_cast< std::vector< double >::value_type >(val4);
  arg4 = &temp4;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_vector_Sl_NTA_Real64_Sg__insert__SWIG_1(arg1,arg2,arg3,(double 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_DoubleVector_insert(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"DoubleVector_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<double,std::allocator< double > >**)(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< double >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_double(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<double,std::allocator< double > >**)(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< double >::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_double(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_DoubleVector_insert__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_DoubleVector_insert__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'DoubleVector_insert'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< NTA_Real64 >::insert(std::vector< double >::iterator,std::vector< double >::value_type const &)\n"
    "    std::vector< NTA_Real64 >::insert(std::vector< double >::iterator,std::vector< double >::size_type,std::vector< double >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_DoubleVector_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 0 ;
  std::vector< double >::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:DoubleVector_reserve",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_reserve" "', argument " "1"" of type '" "std::vector< NTA_Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector_reserve" "', argument " "2"" of type '" "std::vector< double >::size_type""'");
  } 
  arg2 = static_cast< std::vector< double >::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_DoubleVector_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< double >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_capacity" "', argument " "1"" of type '" "std::vector< NTA_Real64 > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< NTA_Real64 > 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_DoubleVector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< NTA_Real64 > *arg1 = (std::vector< NTA_Real64 > *) 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_double_std__allocatorT_double_t_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_DoubleVector" "', argument " "1"" of type '" "std::vector< NTA_Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< NTA_Real64 > * >(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 *DoubleVector_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_double_std__allocatorT_double_t_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_StringVector_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 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_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_iterator" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (swig::SwigPyIterator *)std_vector_Sl_std_string_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_StringVector___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 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_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___nonzero__" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_vector_Sl_std_string_Sg____nonzero__((std::vector< std::string > 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_StringVector___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 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_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___bool__" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_vector_Sl_std_string_Sg____bool__((std::vector< std::string > 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_StringVector___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::string >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___len__" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_std_string_Sg____len__((std::vector< std::string > 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_StringVector_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::string >::value_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_pop" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = std_vector_Sl_std_string_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_std_string(static_cast< std::string >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringVector___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
  std::vector< std::string >::difference_type arg2 ;
  std::vector< std::string >::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< std::string,std::allocator< std::string > > *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:StringVector___getslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___getslice__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___getslice__" "', argument " "2"" of type '" "std::vector< std::string >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::string >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringVector___getslice__" "', argument " "3"" of type '" "std::vector< std::string >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< std::string >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< std::string,std::allocator< std::string > > *)std_vector_Sl_std_string_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_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringVector___setslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
  std::vector< std::string >::difference_type arg2 ;
  std::vector< std::string >::difference_type arg3 ;
  std::vector< std::string,std::allocator< std::string > > const &arg4_defvalue = std::vector< std::string,std::allocator< std::string > >() ;
  std::vector< std::string,std::allocator< std::string > > *arg4 = (std::vector< std::string,std::allocator< std::string > > *) &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:StringVector___setslice__",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___setslice__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___setslice__" "', argument " "2"" of type '" "std::vector< std::string >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::string >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringVector___setslice__" "', argument " "3"" of type '" "std::vector< std::string >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< std::string >::difference_type >(val3);
  if (obj3) {
    {
      std::vector<std::string,std::allocator< std::string > > *ptr = (std::vector<std::string,std::allocator< std::string > > *)0;
      res4 = swig::asptr(obj3, &ptr);
      if (!SWIG_IsOK(res4)) {
        SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "StringVector___setslice__" "', argument " "4"" of type '" "std::vector< std::string,std::allocator< std::string > > const &""'"); 
      }
      if (!ptr) {
        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector___setslice__" "', argument " "4"" of type '" "std::vector< std::string,std::allocator< std::string > > const &""'"); 
      }
      arg4 = ptr;
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_string_Sg____setslice__(arg1,arg2,arg3,(std::vector< std::string,std::allocator< std::string > > 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_StringVector___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
  std::vector< std::string >::difference_type arg2 ;
  std::vector< std::string >::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:StringVector___delslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___delslice__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___delslice__" "', argument " "2"" of type '" "std::vector< std::string >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::string >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringVector___delslice__" "', argument " "3"" of type '" "std::vector< std::string >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< std::string >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_string_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_StringVector___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
  std::vector< std::string >::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_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___delitem__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___delitem__" "', argument " "2"" of type '" "std::vector< std::string >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::string >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_string_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_StringVector___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< std::string,std::allocator< std::string > > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___getitem__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector___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< std::string,std::allocator< std::string > > *)std_vector_Sl_std_string_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_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringVector___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  std::vector< std::string,std::allocator< std::string > > *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_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___setitem__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    std::vector<std::string,std::allocator< std::string > > *ptr = (std::vector<std::string,std::allocator< std::string > > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringVector___setitem__" "', argument " "3"" of type '" "std::vector< std::string,std::allocator< std::string > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector___setitem__" "', argument " "3"" of type '" "std::vector< std::string,std::allocator< std::string > > const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_string_Sg____setitem____SWIG_0(arg1,arg2,(std::vector< std::string,std::allocator< std::string > > 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_StringVector___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 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_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___setitem__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector___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_std_string_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_StringVector___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 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_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___delitem__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector___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_std_string_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_StringVector___delitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"StringVector___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<std::string,std::allocator< std::string > >**)(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<std::string,std::allocator< std::string > >**)(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_StringVector___delitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_StringVector___delitem____SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringVector___delitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::string >::__delitem__(std::vector< std::string >::difference_type)\n"
    "    std::vector< std::string >::__delitem__(PySliceObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_StringVector___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
  std::vector< std::string >::difference_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  std::vector< std::string >::value_type *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___getitem__" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___getitem__" "', argument " "2"" of type '" "std::vector< std::string >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::string >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< std::string >::value_type *) &std_vector_Sl_std_string_Sg____getitem____SWIG_1((std::vector< std::string > 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_std_string(static_cast< std::string >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringVector___getitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"StringVector___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<std::string,std::allocator< std::string > >**)(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<std::string,std::allocator< std::string > >**)(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_StringVector___getitem____SWIG_0(self, argc, argv);
    case 2:
      return _wrap_StringVector___getitem____SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringVector___getitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::string >::__getitem__(PySliceObject *)\n"
    "    std::vector< std::string >::__getitem__(std::vector< std::string >::difference_type) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_StringVector___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
  std::vector< std::string >::difference_type arg2 ;
  std::vector< std::string >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___setitem__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___setitem__" "', argument " "2"" of type '" "std::vector< std::string >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::string >::difference_type >(val2);
  {
    std::string *ptr = (std::string *)0;
    res3 = SWIG_AsPtr_std_string(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringVector___setitem__" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector___setitem__" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_string_Sg____setitem____SWIG_2(arg1,arg2,(std::string 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();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringVector___setitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"StringVector___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<std::string,std::allocator< std::string > >**)(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<std::string,std::allocator< std::string > >**)(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<std::string,std::allocator< 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:
    
    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<std::string,std::allocator< std::string > >**)(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_AsPtr_std_string(argv[2], (std::string**)(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_StringVector___setitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_StringVector___setitem____SWIG_0(self, argc, argv);
    case 3:
      return _wrap_StringVector___setitem____SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringVector___setitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::string >::__setitem__(PySliceObject *,std::vector< std::string,std::allocator< std::string > > const &)\n"
    "    std::vector< std::string >::__setitem__(PySliceObject *)\n"
    "    std::vector< std::string >::__setitem__(std::vector< std::string >::difference_type,std::vector< std::string >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_StringVector_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
  std::vector< std::string >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:StringVector_append",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_append" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(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 '" "StringVector_append" "', argument " "2"" of type '" "std::vector< std::string >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_append" "', argument " "2"" of type '" "std::vector< std::string >::value_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_vector_Sl_std_string_Sg__append(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_new_StringVector__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  std::vector< std::string > *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< std::string > *)new std::vector< std::string >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_StringVector__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  std::vector< std::string > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  {
    std::vector<std::string,std::allocator< std::string > > *ptr = (std::vector<std::string,std::allocator< std::string > > *)0;
    res1 = swig::asptr(swig_obj[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_StringVector" "', argument " "1"" of type '" "std::vector< std::string > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_StringVector" "', argument " "1"" of type '" "std::vector< std::string > const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::string > *)new std::vector< std::string >((std::vector< std::string > 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_std__string_std__allocatorT_std__string_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_StringVector_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 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_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_empty" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((std::vector< std::string > 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_StringVector_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::string >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_size" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< std::string > 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_StringVector_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 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_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_clear" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(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_StringVector_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
  std::vector< std::string > *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:StringVector_swap",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_swap" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "StringVector_swap" "', argument " "2"" of type '" "std::vector< std::string > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_swap" "', argument " "2"" of type '" "std::vector< std::string > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< std::string > * >(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_StringVector_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::allocator< std::string > > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_get_allocator" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< std::string > 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< std::string >::allocator_type(static_cast< const std::vector< std::string >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__string_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringVector_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::string >::iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_begin" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(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< std::string >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringVector_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::string >::iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_end" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(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< std::string >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringVector_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::string >::reverse_iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_rbegin" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(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< std::string >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringVector_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::string >::reverse_iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_rend" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(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< std::string >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_StringVector__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::string >::size_type arg1 ;
  size_t val1 ;
  int ecode1 = 0 ;
  std::vector< std::string > *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_StringVector" "', argument " "1"" of type '" "std::vector< std::string >::size_type""'");
  } 
  arg1 = static_cast< std::vector< std::string >::size_type >(val1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::string > *)new std::vector< std::string >(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_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringVector_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 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_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_pop_back" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(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_StringVector_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
  std::vector< std::string >::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_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_resize" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector_resize" "', argument " "2"" of type '" "std::vector< std::string >::size_type""'");
  } 
  arg2 = static_cast< std::vector< std::string >::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_StringVector_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
  std::vector< std::string >::iterator arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  std::vector< std::string >::iterator result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_erase" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(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 '" "StringVector_erase" "', argument " "2"" of type '" "std::vector< std::string >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::string >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_erase" "', argument " "2"" of type '" "std::vector< std::string >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_std_string_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< std::string >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringVector_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
  std::vector< std::string >::iterator arg2 ;
  std::vector< std::string >::iterator arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  swig::SwigPyIterator *iter3 = 0 ;
  int res3 ;
  std::vector< std::string >::iterator result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_erase" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(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 '" "StringVector_erase" "', argument " "2"" of type '" "std::vector< std::string >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::string >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_erase" "', argument " "2"" of type '" "std::vector< std::string >::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 '" "StringVector_erase" "', argument " "3"" of type '" "std::vector< std::string >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::string >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter3);
    if (iter_t) {
      arg3 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_erase" "', argument " "3"" of type '" "std::vector< std::string >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_std_string_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< std::string >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringVector_erase(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"StringVector_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<std::string,std::allocator< std::string > >**)(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< std::string >::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<std::string,std::allocator< std::string > >**)(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< std::string >::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< std::string >::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_StringVector_erase__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_StringVector_erase__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringVector_erase'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::string >::erase(std::vector< std::string >::iterator)\n"
    "    std::vector< std::string >::erase(std::vector< std::string >::iterator,std::vector< std::string >::iterator)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_new_StringVector__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::string >::size_type arg1 ;
  std::vector< std::string >::value_type *arg2 = 0 ;
  size_t val1 ;
  int ecode1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  std::vector< std::string > *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_StringVector" "', argument " "1"" of type '" "std::vector< std::string >::size_type""'");
  } 
  arg1 = static_cast< std::vector< std::string >::size_type >(val1);
  {
    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 '" "new_StringVector" "', argument " "2"" of type '" "std::vector< std::string >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_StringVector" "', argument " "2"" of type '" "std::vector< std::string >::value_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::string > *)new std::vector< std::string >(arg1,(std::vector< std::string >::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_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_NEW |  0 );
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_StringVector(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_StringVector",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<std::string,std::allocator< std::string > >**)(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_AsPtr_std_string(argv[1], (std::string**)(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_StringVector__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_StringVector__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_new_StringVector__SWIG_1(self, argc, argv);
    case 4:
      return _wrap_new_StringVector__SWIG_3(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_StringVector'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::string >::vector()\n"
    "    std::vector< std::string >::vector(std::vector< std::string > const &)\n"
    "    std::vector< std::string >::vector(std::vector< std::string >::size_type)\n"
    "    std::vector< std::string >::vector(std::vector< std::string >::size_type,std::vector< std::string >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_StringVector_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
  std::vector< std::string >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:StringVector_push_back",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_push_back" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(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 '" "StringVector_push_back" "', argument " "2"" of type '" "std::vector< std::string >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_push_back" "', argument " "2"" of type '" "std::vector< std::string >::value_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->push_back((std::vector< std::string >::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();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringVector_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::string >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_front" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::string >::value_type *) &((std::vector< std::string > 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_std_string(static_cast< std::string >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringVector_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::string >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_back" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::string >::value_type *) &((std::vector< std::string > 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_std_string(static_cast< std::string >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringVector_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
  std::vector< std::string >::size_type arg2 ;
  std::vector< std::string >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  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:StringVector_assign",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_assign" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector_assign" "', argument " "2"" of type '" "std::vector< std::string >::size_type""'");
  } 
  arg2 = static_cast< std::vector< std::string >::size_type >(val2);
  {
    std::string *ptr = (std::string *)0;
    res3 = SWIG_AsPtr_std_string(obj2, &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringVector_assign" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_assign" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->assign(arg2,(std::vector< std::string >::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();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringVector_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
  std::vector< std::string >::size_type arg2 ;
  std::vector< std::string >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_resize" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector_resize" "', argument " "2"" of type '" "std::vector< std::string >::size_type""'");
  } 
  arg2 = static_cast< std::vector< std::string >::size_type >(val2);
  {
    std::string *ptr = (std::string *)0;
    res3 = SWIG_AsPtr_std_string(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringVector_resize" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_resize" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resize(arg2,(std::vector< std::string >::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();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringVector_resize(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"StringVector_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<std::string,std::allocator< std::string > >**)(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<std::string,std::allocator< std::string > >**)(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_AsPtr_std_string(argv[2], (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_StringVector_resize__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_StringVector_resize__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringVector_resize'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::string >::resize(std::vector< std::string >::size_type)\n"
    "    std::vector< std::string >::resize(std::vector< std::string >::size_type,std::vector< std::string >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_StringVector_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
  std::vector< std::string >::iterator arg2 ;
  std::vector< std::string >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  int res3 = SWIG_OLDOBJ ;
  std::vector< std::string >::iterator result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_insert" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(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 '" "StringVector_insert" "', argument " "2"" of type '" "std::vector< std::string >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::string >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_insert" "', argument " "2"" of type '" "std::vector< std::string >::iterator""'");
    }
  }
  {
    std::string *ptr = (std::string *)0;
    res3 = SWIG_AsPtr_std_string(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringVector_insert" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_insert" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_std_string_Sg__insert__SWIG_0(arg1,arg2,(std::string 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< std::string >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringVector_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
  std::vector< std::string >::iterator arg2 ;
  std::vector< std::string >::size_type arg3 ;
  std::vector< std::string >::value_type *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  size_t val3 ;
  int ecode3 = 0 ;
  int res4 = SWIG_OLDOBJ ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_insert" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(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 '" "StringVector_insert" "', argument " "2"" of type '" "std::vector< std::string >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::string >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_insert" "', argument " "2"" of type '" "std::vector< std::string >::iterator""'");
    }
  }
  ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringVector_insert" "', argument " "3"" of type '" "std::vector< std::string >::size_type""'");
  } 
  arg3 = static_cast< std::vector< std::string >::size_type >(val3);
  {
    std::string *ptr = (std::string *)0;
    res4 = SWIG_AsPtr_std_string(swig_obj[3], &ptr);
    if (!SWIG_IsOK(res4)) {
      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "StringVector_insert" "', argument " "4"" of type '" "std::vector< std::string >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_insert" "', argument " "4"" of type '" "std::vector< std::string >::value_type const &""'"); 
    }
    arg4 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_vector_Sl_std_string_Sg__insert__SWIG_1(arg1,arg2,arg3,(std::string 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_StringVector_insert(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"StringVector_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<std::string,std::allocator< std::string > >**)(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< std::string >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_AsPtr_std_string(argv[2], (std::string**)(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;
      {
        int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator< std::string > >**)(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< std::string >::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_AsPtr_std_string(argv[3], (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_StringVector_insert__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_StringVector_insert__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringVector_insert'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::string >::insert(std::vector< std::string >::iterator,std::vector< std::string >::value_type const &)\n"
    "    std::vector< std::string >::insert(std::vector< std::string >::iterator,std::vector< std::string >::size_type,std::vector< std::string >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_StringVector_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
  std::vector< std::string >::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:StringVector_reserve",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_reserve" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector_reserve" "', argument " "2"" of type '" "std::vector< std::string >::size_type""'");
  } 
  arg2 = static_cast< std::vector< std::string >::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_StringVector_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::string >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_capacity" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< std::string > 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_StringVector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::string > *arg1 = (std::vector< std::string > *) 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_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_StringVector" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::string > * >(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 *StringVector_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_std__string_std__allocatorT_std__string_t_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_StringList_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 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__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList_iterator" "', argument " "1"" of type '" "std::list< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (swig::SwigPyIterator *)std_list_Sl_std_string_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_StringList___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 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__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList___nonzero__" "', argument " "1"" of type '" "std::list< std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_list_Sl_std_string_Sg____nonzero__((std::list< std::string > 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_StringList___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 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__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList___bool__" "', argument " "1"" of type '" "std::list< std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_list_Sl_std_string_Sg____bool__((std::list< std::string > 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_StringList___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::list< std::string >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList___len__" "', argument " "1"" of type '" "std::list< std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_list_Sl_std_string_Sg____len__((std::list< std::string > 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_StringList_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::list< std::string >::value_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList_pop" "', argument " "1"" of type '" "std::list< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = std_list_Sl_std_string_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_std_string(static_cast< std::string >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringList___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 0 ;
  std::list< std::string >::difference_type arg2 ;
  std::list< std::string >::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::list< std::string,std::allocator< std::string > > *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:StringList___getslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList___getslice__" "', argument " "1"" of type '" "std::list< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringList___getslice__" "', argument " "2"" of type '" "std::list< std::string >::difference_type""'");
  } 
  arg2 = static_cast< std::list< std::string >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringList___getslice__" "', argument " "3"" of type '" "std::list< std::string >::difference_type""'");
  } 
  arg3 = static_cast< std::list< std::string >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::list< std::string,std::allocator< std::string > > *)std_list_Sl_std_string_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__listT_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringList___setslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 0 ;
  std::list< std::string >::difference_type arg2 ;
  std::list< std::string >::difference_type arg3 ;
  std::list< std::string,std::allocator< std::string > > const &arg4_defvalue = std::list< std::string,std::allocator< std::string > >() ;
  std::list< std::string,std::allocator< std::string > > *arg4 = (std::list< std::string,std::allocator< std::string > > *) &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:StringList___setslice__",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList___setslice__" "', argument " "1"" of type '" "std::list< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringList___setslice__" "', argument " "2"" of type '" "std::list< std::string >::difference_type""'");
  } 
  arg2 = static_cast< std::list< std::string >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringList___setslice__" "', argument " "3"" of type '" "std::list< std::string >::difference_type""'");
  } 
  arg3 = static_cast< std::list< std::string >::difference_type >(val3);
  if (obj3) {
    {
      std::list<std::string,std::allocator< std::string > > *ptr = (std::list<std::string,std::allocator< std::string > > *)0;
      res4 = swig::asptr(obj3, &ptr);
      if (!SWIG_IsOK(res4)) {
        SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "StringList___setslice__" "', argument " "4"" of type '" "std::list< std::string,std::allocator< std::string > > const &""'"); 
      }
      if (!ptr) {
        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringList___setslice__" "', argument " "4"" of type '" "std::list< std::string,std::allocator< std::string > > const &""'"); 
      }
      arg4 = ptr;
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_list_Sl_std_string_Sg____setslice__(arg1,arg2,arg3,(std::list< std::string,std::allocator< std::string > > 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_StringList___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 0 ;
  std::list< std::string >::difference_type arg2 ;
  std::list< std::string >::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:StringList___delslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList___delslice__" "', argument " "1"" of type '" "std::list< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringList___delslice__" "', argument " "2"" of type '" "std::list< std::string >::difference_type""'");
  } 
  arg2 = static_cast< std::list< std::string >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringList___delslice__" "', argument " "3"" of type '" "std::list< std::string >::difference_type""'");
  } 
  arg3 = static_cast< std::list< std::string >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_list_Sl_std_string_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_StringList___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 0 ;
  std::list< std::string >::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__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList___delitem__" "', argument " "1"" of type '" "std::list< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringList___delitem__" "', argument " "2"" of type '" "std::list< std::string >::difference_type""'");
  } 
  arg2 = static_cast< std::list< std::string >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_list_Sl_std_string_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_StringList___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::list< std::string,std::allocator< std::string > > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList___getitem__" "', argument " "1"" of type '" "std::list< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringList___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::list< std::string,std::allocator< std::string > > *)std_list_Sl_std_string_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__listT_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringList___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  std::list< std::string,std::allocator< std::string > > *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__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList___setitem__" "', argument " "1"" of type '" "std::list< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringList___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    std::list<std::string,std::allocator< std::string > > *ptr = (std::list<std::string,std::allocator< std::string > > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringList___setitem__" "', argument " "3"" of type '" "std::list< std::string,std::allocator< std::string > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringList___setitem__" "', argument " "3"" of type '" "std::list< std::string,std::allocator< std::string > > const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_list_Sl_std_string_Sg____setitem____SWIG_0(arg1,arg2,(std::list< std::string,std::allocator< std::string > > 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_StringList___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 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__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList___setitem__" "', argument " "1"" of type '" "std::list< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringList___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_list_Sl_std_string_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_StringList___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 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__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList___delitem__" "', argument " "1"" of type '" "std::list< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringList___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_list_Sl_std_string_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_StringList___delitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"StringList___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::list<std::string,std::allocator< std::string > >**)(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::list<std::string,std::allocator< std::string > >**)(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_StringList___delitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_StringList___delitem____SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringList___delitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::list< std::string >::__delitem__(std::list< std::string >::difference_type)\n"
    "    std::list< std::string >::__delitem__(PySliceObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_StringList___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 0 ;
  std::list< std::string >::difference_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  std::list< std::string >::value_type *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList___getitem__" "', argument " "1"" of type '" "std::list< std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringList___getitem__" "', argument " "2"" of type '" "std::list< std::string >::difference_type""'");
  } 
  arg2 = static_cast< std::list< std::string >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::list< std::string >::value_type *) &std_list_Sl_std_string_Sg____getitem____SWIG_1((std::list< std::string > 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_std_string(static_cast< std::string >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringList___getitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"StringList___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::list<std::string,std::allocator< std::string > >**)(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::list<std::string,std::allocator< std::string > >**)(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_StringList___getitem____SWIG_0(self, argc, argv);
    case 2:
      return _wrap_StringList___getitem____SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringList___getitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::list< std::string >::__getitem__(PySliceObject *)\n"
    "    std::list< std::string >::__getitem__(std::list< std::string >::difference_type) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_StringList___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 0 ;
  std::list< std::string >::difference_type arg2 ;
  std::list< std::string >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList___setitem__" "', argument " "1"" of type '" "std::list< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringList___setitem__" "', argument " "2"" of type '" "std::list< std::string >::difference_type""'");
  } 
  arg2 = static_cast< std::list< std::string >::difference_type >(val2);
  {
    std::string *ptr = (std::string *)0;
    res3 = SWIG_AsPtr_std_string(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringList___setitem__" "', argument " "3"" of type '" "std::list< std::string >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringList___setitem__" "', argument " "3"" of type '" "std::list< std::string >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_list_Sl_std_string_Sg____setitem____SWIG_2(arg1,arg2,(std::string 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();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringList___setitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"StringList___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::list<std::string,std::allocator< std::string > >**)(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::list<std::string,std::allocator< std::string > >**)(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::list<std::string,std::allocator< 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:
    
    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::list<std::string,std::allocator< std::string > >**)(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_AsPtr_std_string(argv[2], (std::string**)(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_StringList___setitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_StringList___setitem____SWIG_0(self, argc, argv);
    case 3:
      return _wrap_StringList___setitem____SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringList___setitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::list< std::string >::__setitem__(PySliceObject *,std::list< std::string,std::allocator< std::string > > const &)\n"
    "    std::list< std::string >::__setitem__(PySliceObject *)\n"
    "    std::list< std::string >::__setitem__(std::list< std::string >::difference_type,std::list< std::string >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_StringList_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 0 ;
  std::list< std::string >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:StringList_append",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList_append" "', argument " "1"" of type '" "std::list< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(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 '" "StringList_append" "', argument " "2"" of type '" "std::list< std::string >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringList_append" "', argument " "2"" of type '" "std::list< std::string >::value_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_list_Sl_std_string_Sg__append(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_new_StringList__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  std::list< std::string > *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::list< std::string > *)new std::list< std::string >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__listT_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_StringList__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  std::list< std::string > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  {
    std::list<std::string,std::allocator< std::string > > *ptr = (std::list<std::string,std::allocator< std::string > > *)0;
    res1 = swig::asptr(swig_obj[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_StringList" "', argument " "1"" of type '" "std::list< std::string > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_StringList" "', argument " "1"" of type '" "std::list< std::string > const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::list< std::string > *)new std::list< std::string >((std::list< std::string > 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__listT_std__string_std__allocatorT_std__string_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_StringList_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 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__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList_empty" "', argument " "1"" of type '" "std::list< std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((std::list< std::string > 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_StringList_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::list< std::string >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList_size" "', argument " "1"" of type '" "std::list< std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::list< std::string > 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_StringList_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 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__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList_clear" "', argument " "1"" of type '" "std::list< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(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_StringList_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 0 ;
  std::list< std::string > *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:StringList_swap",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList_swap" "', argument " "1"" of type '" "std::list< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "StringList_swap" "', argument " "2"" of type '" "std::list< std::string > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringList_swap" "', argument " "2"" of type '" "std::list< std::string > &""'"); 
  }
  arg2 = reinterpret_cast< std::list< std::string > * >(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_StringList_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::allocator< std::string > > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList_get_allocator" "', argument " "1"" of type '" "std::list< std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::list< std::string > 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::list< std::string >::allocator_type(static_cast< const std::list< std::string >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__string_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringList_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::list< std::string >::iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList_begin" "', argument " "1"" of type '" "std::list< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(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::list< std::string >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringList_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::list< std::string >::iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList_end" "', argument " "1"" of type '" "std::list< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(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::list< std::string >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringList_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::list< std::string >::reverse_iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList_rbegin" "', argument " "1"" of type '" "std::list< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(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::list< std::string >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringList_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::list< std::string >::reverse_iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList_rend" "', argument " "1"" of type '" "std::list< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(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::list< std::string >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_StringList__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::list< std::string >::size_type arg1 ;
  size_t val1 ;
  int ecode1 = 0 ;
  std::list< std::string > *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_StringList" "', argument " "1"" of type '" "std::list< std::string >::size_type""'");
  } 
  arg1 = static_cast< std::list< std::string >::size_type >(val1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::list< std::string > *)new std::list< std::string >(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__listT_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringList_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 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__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList_pop_back" "', argument " "1"" of type '" "std::list< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(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_StringList_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 0 ;
  std::list< std::string >::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__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList_resize" "', argument " "1"" of type '" "std::list< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringList_resize" "', argument " "2"" of type '" "std::list< std::string >::size_type""'");
  } 
  arg2 = static_cast< std::list< std::string >::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_StringList_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 0 ;
  std::list< std::string >::iterator arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  std::list< std::string >::iterator result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList_erase" "', argument " "1"" of type '" "std::list< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(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 '" "StringList_erase" "', argument " "2"" of type '" "std::list< std::string >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::list< std::string >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::list< std::string >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringList_erase" "', argument " "2"" of type '" "std::list< std::string >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_list_Sl_std_string_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::list< std::string >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringList_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 0 ;
  std::list< std::string >::iterator arg2 ;
  std::list< std::string >::iterator arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  swig::SwigPyIterator *iter3 = 0 ;
  int res3 ;
  std::list< std::string >::iterator result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList_erase" "', argument " "1"" of type '" "std::list< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(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 '" "StringList_erase" "', argument " "2"" of type '" "std::list< std::string >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::list< std::string >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::list< std::string >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringList_erase" "', argument " "2"" of type '" "std::list< std::string >::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 '" "StringList_erase" "', argument " "3"" of type '" "std::list< std::string >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::list< std::string >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::list< std::string >::iterator > *>(iter3);
    if (iter_t) {
      arg3 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringList_erase" "', argument " "3"" of type '" "std::list< std::string >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_list_Sl_std_string_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::list< std::string >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringList_erase(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"StringList_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::list<std::string,std::allocator< std::string > >**)(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::list< std::string >::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::list<std::string,std::allocator< std::string > >**)(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::list< std::string >::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::list< std::string >::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_StringList_erase__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_StringList_erase__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringList_erase'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::list< std::string >::erase(std::list< std::string >::iterator)\n"
    "    std::list< std::string >::erase(std::list< std::string >::iterator,std::list< std::string >::iterator)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_new_StringList__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::list< std::string >::size_type arg1 ;
  std::list< std::string >::value_type *arg2 = 0 ;
  size_t val1 ;
  int ecode1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  std::list< std::string > *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_StringList" "', argument " "1"" of type '" "std::list< std::string >::size_type""'");
  } 
  arg1 = static_cast< std::list< std::string >::size_type >(val1);
  {
    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 '" "new_StringList" "', argument " "2"" of type '" "std::list< std::string >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_StringList" "', argument " "2"" of type '" "std::list< std::string >::value_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::list< std::string > *)new std::list< std::string >(arg1,(std::list< std::string >::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__listT_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_NEW |  0 );
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_StringList(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_StringList",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::list<std::string,std::allocator< std::string > >**)(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_AsPtr_std_string(argv[1], (std::string**)(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_StringList__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_StringList__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_new_StringList__SWIG_1(self, argc, argv);
    case 4:
      return _wrap_new_StringList__SWIG_3(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_StringList'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::list< std::string >::list()\n"
    "    std::list< std::string >::list(std::list< std::string > const &)\n"
    "    std::list< std::string >::list(std::list< std::string >::size_type)\n"
    "    std::list< std::string >::list(std::list< std::string >::size_type,std::list< std::string >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_StringList_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 0 ;
  std::list< std::string >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:StringList_push_back",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList_push_back" "', argument " "1"" of type '" "std::list< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(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 '" "StringList_push_back" "', argument " "2"" of type '" "std::list< std::string >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringList_push_back" "', argument " "2"" of type '" "std::list< std::string >::value_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->push_back((std::list< std::string >::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();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringList_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::list< std::string >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList_front" "', argument " "1"" of type '" "std::list< std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::list< std::string >::value_type *) &((std::list< std::string > 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_std_string(static_cast< std::string >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringList_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::list< std::string >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList_back" "', argument " "1"" of type '" "std::list< std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::list< std::string >::value_type *) &((std::list< std::string > 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_std_string(static_cast< std::string >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringList_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 0 ;
  std::list< std::string >::size_type arg2 ;
  std::list< std::string >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  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:StringList_assign",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList_assign" "', argument " "1"" of type '" "std::list< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringList_assign" "', argument " "2"" of type '" "std::list< std::string >::size_type""'");
  } 
  arg2 = static_cast< std::list< std::string >::size_type >(val2);
  {
    std::string *ptr = (std::string *)0;
    res3 = SWIG_AsPtr_std_string(obj2, &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringList_assign" "', argument " "3"" of type '" "std::list< std::string >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringList_assign" "', argument " "3"" of type '" "std::list< std::string >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->assign(arg2,(std::list< std::string >::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();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringList_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 0 ;
  std::list< std::string >::size_type arg2 ;
  std::list< std::string >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList_resize" "', argument " "1"" of type '" "std::list< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringList_resize" "', argument " "2"" of type '" "std::list< std::string >::size_type""'");
  } 
  arg2 = static_cast< std::list< std::string >::size_type >(val2);
  {
    std::string *ptr = (std::string *)0;
    res3 = SWIG_AsPtr_std_string(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringList_resize" "', argument " "3"" of type '" "std::list< std::string >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringList_resize" "', argument " "3"" of type '" "std::list< std::string >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resize(arg2,(std::list< std::string >::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();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringList_resize(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"StringList_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::list<std::string,std::allocator< std::string > >**)(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::list<std::string,std::allocator< std::string > >**)(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_AsPtr_std_string(argv[2], (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_StringList_resize__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_StringList_resize__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringList_resize'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::list< std::string >::resize(std::list< std::string >::size_type)\n"
    "    std::list< std::string >::resize(std::list< std::string >::size_type,std::list< std::string >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_StringList_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 0 ;
  std::list< std::string >::iterator arg2 ;
  std::list< std::string >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  int res3 = SWIG_OLDOBJ ;
  std::list< std::string >::iterator result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList_insert" "', argument " "1"" of type '" "std::list< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(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 '" "StringList_insert" "', argument " "2"" of type '" "std::list< std::string >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::list< std::string >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::list< std::string >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringList_insert" "', argument " "2"" of type '" "std::list< std::string >::iterator""'");
    }
  }
  {
    std::string *ptr = (std::string *)0;
    res3 = SWIG_AsPtr_std_string(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringList_insert" "', argument " "3"" of type '" "std::list< std::string >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringList_insert" "', argument " "3"" of type '" "std::list< std::string >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_list_Sl_std_string_Sg__insert__SWIG_0(arg1,arg2,(std::string 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::list< std::string >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringList_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 0 ;
  std::list< std::string >::iterator arg2 ;
  std::list< std::string >::size_type arg3 ;
  std::list< std::string >::value_type *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  size_t val3 ;
  int ecode3 = 0 ;
  int res4 = SWIG_OLDOBJ ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList_insert" "', argument " "1"" of type '" "std::list< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(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 '" "StringList_insert" "', argument " "2"" of type '" "std::list< std::string >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::list< std::string >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::list< std::string >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringList_insert" "', argument " "2"" of type '" "std::list< std::string >::iterator""'");
    }
  }
  ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringList_insert" "', argument " "3"" of type '" "std::list< std::string >::size_type""'");
  } 
  arg3 = static_cast< std::list< std::string >::size_type >(val3);
  {
    std::string *ptr = (std::string *)0;
    res4 = SWIG_AsPtr_std_string(swig_obj[3], &ptr);
    if (!SWIG_IsOK(res4)) {
      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "StringList_insert" "', argument " "4"" of type '" "std::list< std::string >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringList_insert" "', argument " "4"" of type '" "std::list< std::string >::value_type const &""'"); 
    }
    arg4 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_list_Sl_std_string_Sg__insert__SWIG_1(arg1,arg2,arg3,(std::string 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_StringList_insert(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"StringList_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::list<std::string,std::allocator< std::string > >**)(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::list< std::string >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_AsPtr_std_string(argv[2], (std::string**)(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;
      {
        int res = swig::asptr(argv[0], (std::list<std::string,std::allocator< std::string > >**)(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::list< std::string >::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_AsPtr_std_string(argv[3], (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_StringList_insert__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_StringList_insert__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringList_insert'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::list< std::string >::insert(std::list< std::string >::iterator,std::list< std::string >::value_type const &)\n"
    "    std::list< std::string >::insert(std::list< std::string >::iterator,std::list< std::string >::size_type,std::list< std::string >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_StringList_pop_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 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__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList_pop_front" "', argument " "1"" of type '" "std::list< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->pop_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_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringList_push_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 0 ;
  std::list< std::string >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:StringList_push_front",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList_push_front" "', argument " "1"" of type '" "std::list< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(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 '" "StringList_push_front" "', argument " "2"" of type '" "std::list< std::string >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringList_push_front" "', argument " "2"" of type '" "std::list< std::string >::value_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->push_front((std::list< std::string >::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();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringList_reverse(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 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__listT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringList_reverse" "', argument " "1"" of type '" "std::list< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->reverse();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_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_StringList(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::list< std::string > *arg1 = (std::list< std::string > *) 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__listT_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_StringList" "', argument " "1"" of type '" "std::list< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::list< std::string > * >(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 *StringList_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__listT_std__string_std__allocatorT_std__string_t_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new_StringSet__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::less< std::string > *arg1 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::set< std::string > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_std__lessT_std__string_t,  0  | 0);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_StringSet" "', argument " "1"" of type '" "std::less< std::string > const &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_StringSet" "', argument " "1"" of type '" "std::less< std::string > const &""'"); 
  }
  arg1 = reinterpret_cast< std::less< std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::set< std::string > *)new std::set< std::string >((std::less< std::string > 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__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringSet_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::set< std::string > *arg1 = (std::set< std::string > *) 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__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringSet_iterator" "', argument " "1"" of type '" "std::set< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::set< std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (swig::SwigPyIterator *)std_set_Sl_std_string_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_StringSet___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::set< std::string > *arg1 = (std::set< std::string > *) 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__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringSet___nonzero__" "', argument " "1"" of type '" "std::set< std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::set< std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_set_Sl_std_string_Sg____nonzero__((std::set< std::string > 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_StringSet___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::set< std::string > *arg1 = (std::set< std::string > *) 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__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringSet___bool__" "', argument " "1"" of type '" "std::set< std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::set< std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_set_Sl_std_string_Sg____bool__((std::set< std::string > 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_StringSet___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::set< std::string > *arg1 = (std::set< std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::set< std::string >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringSet___len__" "', argument " "1"" of type '" "std::set< std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::set< std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_set_Sl_std_string_Sg____len__((std::set< std::string > 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_StringSet_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::set< std::string > *arg1 = (std::set< std::string > *) 0 ;
  std::set< std::string >::value_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:StringSet_append",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringSet_append" "', argument " "1"" of type '" "std::set< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::set< std::string > * >(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 '" "StringSet_append" "', argument " "2"" of type '" "std::set< std::string >::value_type""'"); 
    }
    arg2 = *ptr;
    if (SWIG_IsNewObj(res)) delete ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_set_Sl_std_string_Sg__append(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_StringSet___contains__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::set< std::string > *arg1 = (std::set< std::string > *) 0 ;
  std::set< std::string >::value_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:StringSet___contains__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringSet___contains__" "', argument " "1"" of type '" "std::set< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::set< std::string > * >(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 '" "StringSet___contains__" "', argument " "2"" of type '" "std::set< std::string >::value_type""'"); 
    }
    arg2 = *ptr;
    if (SWIG_IsNewObj(res)) delete ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_set_Sl_std_string_Sg____contains__(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_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringSet___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::set< std::string > *arg1 = (std::set< std::string > *) 0 ;
  std::set< std::string >::difference_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i", NULL 
  };
  std::set< std::string >::value_type result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:StringSet___getitem__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringSet___getitem__" "', argument " "1"" of type '" "std::set< std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::set< std::string > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringSet___getitem__" "', argument " "2"" of type '" "std::set< std::string >::difference_type""'");
  } 
  arg2 = static_cast< std::set< std::string >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = std_set_Sl_std_string_Sg____getitem__((std::set< std::string > 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_std_string(static_cast< std::string >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringSet_add(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::set< std::string > *arg1 = (std::set< std::string > *) 0 ;
  std::set< std::string >::value_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:StringSet_add",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringSet_add" "', argument " "1"" of type '" "std::set< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::set< std::string > * >(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 '" "StringSet_add" "', argument " "2"" of type '" "std::set< std::string >::value_type""'"); 
    }
    arg2 = *ptr;
    if (SWIG_IsNewObj(res)) delete ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_set_Sl_std_string_Sg__add(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_StringSet_discard(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::set< std::string > *arg1 = (std::set< std::string > *) 0 ;
  std::set< std::string >::value_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:StringSet_discard",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringSet_discard" "', argument " "1"" of type '" "std::set< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::set< std::string > * >(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 '" "StringSet_discard" "', argument " "2"" of type '" "std::set< std::string >::value_type""'"); 
    }
    arg2 = *ptr;
    if (SWIG_IsNewObj(res)) delete ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_set_Sl_std_string_Sg__discard(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_new_StringSet__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  std::set< std::string > *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::set< std::string > *)new std::set< std::string >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_StringSet__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::set< std::string > *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  std::set< std::string > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  {
    std::set<std::string,std::less< std::string >,std::allocator< std::string > > *ptr = (std::set<std::string,std::less< std::string >,std::allocator< std::string > > *)0;
    res1 = swig::asptr(swig_obj[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_StringSet" "', argument " "1"" of type '" "std::set< std::string > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_StringSet" "', argument " "1"" of type '" "std::set< std::string > const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::set< std::string > *)new std::set< std::string >((std::set< std::string > 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__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_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_new_StringSet(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[2];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_StringSet",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_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__lessT_std__string_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 == 1) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::set<std::string,std::less< std::string >,std::allocator< std::string > >**)(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_StringSet__SWIG_1(self, argc, argv);
    case 2:
      return _wrap_new_StringSet__SWIG_0(self, argc, argv);
    case 3:
      return _wrap_new_StringSet__SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_StringSet'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::set< std::string >::set(std::less< std::string > const &)\n"
    "    std::set< std::string >::set()\n"
    "    std::set< std::string >::set(std::set< std::string > const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_StringSet_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::set< std::string > *arg1 = (std::set< std::string > *) 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__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringSet_empty" "', argument " "1"" of type '" "std::set< std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::set< std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((std::set< std::string > 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_StringSet_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::set< std::string > *arg1 = (std::set< std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::set< std::string >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringSet_size" "', argument " "1"" of type '" "std::set< std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::set< std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::set< std::string > 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_StringSet_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::set< std::string > *arg1 = (std::set< std::string > *) 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__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringSet_clear" "', argument " "1"" of type '" "std::set< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::set< std::string > * >(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_StringSet_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::set< std::string > *arg1 = (std::set< std::string > *) 0 ;
  std::set< std::string > *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:StringSet_swap",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringSet_swap" "', argument " "1"" of type '" "std::set< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::set< std::string > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "StringSet_swap" "', argument " "2"" of type '" "std::set< std::string > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringSet_swap" "', argument " "2"" of type '" "std::set< std::string > &""'"); 
  }
  arg2 = reinterpret_cast< std::set< std::string > * >(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_StringSet_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::set< std::string > *arg1 = (std::set< std::string > *) 0 ;
  std::set< std::string >::key_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  std::set< std::string >::size_type result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringSet_erase" "', argument " "1"" of type '" "std::set< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::set< std::string > * >(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 '" "StringSet_erase" "', argument " "2"" of type '" "std::set< std::string >::key_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringSet_erase" "', argument " "2"" of type '" "std::set< std::string >::key_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->erase((std::set< std::string >::key_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_From_size_t(static_cast< size_t >(result));
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringSet_count(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::set< std::string > *arg1 = (std::set< std::string > *) 0 ;
  std::set< std::string >::key_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  std::set< std::string >::size_type result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:StringSet_count",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringSet_count" "', argument " "1"" of type '" "std::set< std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::set< std::string > * >(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 '" "StringSet_count" "', argument " "2"" of type '" "std::set< std::string >::key_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringSet_count" "', argument " "2"" of type '" "std::set< std::string >::key_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::set< std::string > const *)arg1)->count((std::set< std::string >::key_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_From_size_t(static_cast< size_t >(result));
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringSet_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::set< std::string > *arg1 = (std::set< std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::set< std::string >::iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringSet_begin" "', argument " "1"" of type '" "std::set< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::set< std::string > * >(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::set< std::string >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringSet_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::set< std::string > *arg1 = (std::set< std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::set< std::string >::iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringSet_end" "', argument " "1"" of type '" "std::set< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::set< std::string > * >(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::set< std::string >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringSet_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::set< std::string > *arg1 = (std::set< std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::set< std::string >::reverse_iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringSet_rbegin" "', argument " "1"" of type '" "std::set< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::set< std::string > * >(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::set< std::string >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringSet_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::set< std::string > *arg1 = (std::set< std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::set< std::string >::reverse_iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringSet_rend" "', argument " "1"" of type '" "std::set< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::set< std::string > * >(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::set< std::string >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringSet_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::set< std::string > *arg1 = (std::set< std::string > *) 0 ;
  std::set< std::string >::iterator arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringSet_erase" "', argument " "1"" of type '" "std::set< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::set< std::string > * >(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 '" "StringSet_erase" "', argument " "2"" of type '" "std::set< std::string >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::set< std::string >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::set< std::string >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringSet_erase" "', argument " "2"" of type '" "std::set< std::string >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_set_Sl_std_string_Sg__erase__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_StringSet_erase__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::set< std::string > *arg1 = (std::set< std::string > *) 0 ;
  std::set< std::string >::iterator arg2 ;
  std::set< std::string >::iterator arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  swig::SwigPyIterator *iter3 = 0 ;
  int res3 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringSet_erase" "', argument " "1"" of type '" "std::set< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::set< std::string > * >(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 '" "StringSet_erase" "', argument " "2"" of type '" "std::set< std::string >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::set< std::string >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::set< std::string >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringSet_erase" "', argument " "2"" of type '" "std::set< std::string >::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 '" "StringSet_erase" "', argument " "3"" of type '" "std::set< std::string >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::set< std::string >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::set< std::string >::iterator > *>(iter3);
    if (iter_t) {
      arg3 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringSet_erase" "', argument " "3"" of type '" "std::set< std::string >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_set_Sl_std_string_Sg__erase__SWIG_2(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_StringSet_erase(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"StringSet_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::set<std::string,std::less< std::string >,std::allocator< std::string > >**)(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::set< std::string >::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 == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::set<std::string,std::less< std::string >,std::allocator< std::string > >**)(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:
    
    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::set<std::string,std::less< std::string >,std::allocator< std::string > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_3;
      _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::set< std::string >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_3;
      _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::set< std::string >::iterator > *>(iter) != 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_StringSet_erase__SWIG_1(self, argc, argv);
    case 2:
      return _wrap_StringSet_erase__SWIG_0(self, argc, argv);
    case 3:
      return _wrap_StringSet_erase__SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringSet_erase'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::set< std::string >::erase(std::set< std::string >::key_type const &)\n"
    "    std::set< std::string >::erase(std::set< std::string >::iterator)\n"
    "    std::set< std::string >::erase(std::set< std::string >::iterator,std::set< std::string >::iterator)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_StringSet_find(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::set< std::string > *arg1 = (std::set< std::string > *) 0 ;
  std::set< std::string >::key_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  std::set< std::string >::iterator result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:StringSet_find",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringSet_find" "', argument " "1"" of type '" "std::set< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::set< std::string > * >(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 '" "StringSet_find" "', argument " "2"" of type '" "std::set< std::string >::key_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringSet_find" "', argument " "2"" of type '" "std::set< std::string >::key_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->find((std::set< std::string >::key_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::make_output_iterator(static_cast< const std::set< std::string >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringSet_lower_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::set< std::string > *arg1 = (std::set< std::string > *) 0 ;
  std::set< std::string >::key_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  std::set< std::string >::iterator result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:StringSet_lower_bound",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringSet_lower_bound" "', argument " "1"" of type '" "std::set< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::set< std::string > * >(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 '" "StringSet_lower_bound" "', argument " "2"" of type '" "std::set< std::string >::key_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringSet_lower_bound" "', argument " "2"" of type '" "std::set< std::string >::key_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->lower_bound((std::set< std::string >::key_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::make_output_iterator(static_cast< const std::set< std::string >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringSet_upper_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::set< std::string > *arg1 = (std::set< std::string > *) 0 ;
  std::set< std::string >::key_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  std::set< std::string >::iterator result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:StringSet_upper_bound",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringSet_upper_bound" "', argument " "1"" of type '" "std::set< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::set< std::string > * >(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 '" "StringSet_upper_bound" "', argument " "2"" of type '" "std::set< std::string >::key_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringSet_upper_bound" "', argument " "2"" of type '" "std::set< std::string >::key_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->upper_bound((std::set< std::string >::key_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::make_output_iterator(static_cast< const std::set< std::string >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringSet_equal_range(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::set< std::string > *arg1 = (std::set< std::string > *) 0 ;
  std::set< std::string >::key_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  SwigValueWrapper< std::pair< std::set< std::string >::iterator,std::set< std::string >::iterator > > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:StringSet_equal_range",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringSet_equal_range" "', argument " "1"" of type '" "std::set< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::set< std::string > * >(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 '" "StringSet_equal_range" "', argument " "2"" of type '" "std::set< std::string >::key_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringSet_equal_range" "', argument " "2"" of type '" "std::set< std::string >::key_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->equal_range((std::set< std::string >::key_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 = PyTuple_New(2);
  PyTuple_SetItem(resultobj,0,SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::pair< std::set< std::string >::iterator,std::set< std::string >::iterator > & >(result).first),
      swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN));
  PyTuple_SetItem(resultobj,1,SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::pair< std::set< std::string >::iterator,std::set< std::string >::iterator > & >(result).second),
      swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN));
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringSet_insert(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::set< std::string > *arg1 = (std::set< std::string > *) 0 ;
  std::set< std::string >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "__x", NULL 
  };
  SwigValueWrapper< std::pair< std::set< std::string >::iterator,bool > > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:StringSet_insert",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringSet_insert" "', argument " "1"" of type '" "std::set< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::set< std::string > * >(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 '" "StringSet_insert" "', argument " "2"" of type '" "std::set< std::string >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringSet_insert" "', argument " "2"" of type '" "std::set< std::string >::value_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->insert((std::set< std::string >::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 = PyTuple_New(2);
  PyTuple_SetItem(resultobj,0,SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::pair< std::set< std::string >::iterator,bool > & >(result).first),
      swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN));    
  PyTuple_SetItem(resultobj,1,SWIG_From_bool  (static_cast< const std::pair< std::set< std::string >::iterator,bool > & >(result).second));
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_StringSet(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::set< std::string > *arg1 = (std::set< std::string > *) 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__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_StringSet" "', argument " "1"" of type '" "std::set< std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::set< std::string > * >(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 *StringSet_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__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new_StringMap__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::less< std::string > *arg1 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::map< std::string,std::string > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_std__lessT_std__string_t,  0  | 0);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_StringMap" "', argument " "1"" of type '" "std::less< std::string > const &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_StringMap" "', argument " "1"" of type '" "std::less< std::string > const &""'"); 
  }
  arg1 = reinterpret_cast< std::less< std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::map< std::string,std::string > *)new std::map< std::string,std::string >((std::less< std::string > 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__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringMap_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 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__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap_iterator" "', argument " "1"" of type '" "std::map< std::string,std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (swig::SwigPyIterator *)std_map_Sl_std_string_Sc_std_string_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_StringMap___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 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__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap___nonzero__" "', argument " "1"" of type '" "std::map< std::string,std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_map_Sl_std_string_Sc_std_string_Sg____nonzero__((std::map< std::string,std::string > 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_StringMap___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 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__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap___bool__" "', argument " "1"" of type '" "std::map< std::string,std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_map_Sl_std_string_Sc_std_string_Sg____bool__((std::map< std::string,std::string > 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_StringMap___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::map< std::string,std::string >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap___len__" "', argument " "1"" of type '" "std::map< std::string,std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_map_Sl_std_string_Sc_std_string_Sg____len__((std::map< std::string,std::string > 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_StringMap___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 0 ;
  std::map< std::string,std::string >::key_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "key", NULL 
  };
  std::map< std::string,std::string >::mapped_type *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:StringMap___getitem__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap___getitem__" "', argument " "1"" of type '" "std::map< std::string,std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(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 '" "StringMap___getitem__" "', argument " "2"" of type '" "std::map< std::string,std::string >::key_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringMap___getitem__" "', argument " "2"" of type '" "std::map< std::string,std::string >::key_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::map< std::string,std::string >::mapped_type *) &std_map_Sl_std_string_Sc_std_string_Sg____getitem__(arg1,(std::string const &)*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_std_string(static_cast< std::string >(*result));
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringMap___delitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 0 ;
  std::map< std::string,std::string >::key_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "key", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:StringMap___delitem__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap___delitem__" "', argument " "1"" of type '" "std::map< std::string,std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(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 '" "StringMap___delitem__" "', argument " "2"" of type '" "std::map< std::string,std::string >::key_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringMap___delitem__" "', argument " "2"" of type '" "std::map< std::string,std::string >::key_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_map_Sl_std_string_Sc_std_string_Sg____delitem__(arg1,(std::string const &)*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();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringMap_has_key(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 0 ;
  std::map< std::string,std::string >::key_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "key", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:StringMap_has_key",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap_has_key" "', argument " "1"" of type '" "std::map< std::string,std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(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 '" "StringMap_has_key" "', argument " "2"" of type '" "std::map< std::string,std::string >::key_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringMap_has_key" "', argument " "2"" of type '" "std::map< std::string,std::string >::key_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_map_Sl_std_string_Sc_std_string_Sg__has_key((std::map< std::string,std::string > const *)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_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_StringMap_keys(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 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_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap_keys" "', argument " "1"" of type '" "std::map< std::string,std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)std_map_Sl_std_string_Sc_std_string_Sg__keys(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_StringMap_values(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 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_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap_values" "', argument " "1"" of type '" "std::map< std::string,std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)std_map_Sl_std_string_Sc_std_string_Sg__values(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_StringMap_items(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 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_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap_items" "', argument " "1"" of type '" "std::map< std::string,std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)std_map_Sl_std_string_Sc_std_string_Sg__items(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_StringMap___contains__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 0 ;
  std::map< std::string,std::string >::key_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "key", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:StringMap___contains__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap___contains__" "', argument " "1"" of type '" "std::map< std::string,std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(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 '" "StringMap___contains__" "', argument " "2"" of type '" "std::map< std::string,std::string >::key_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringMap___contains__" "', argument " "2"" of type '" "std::map< std::string,std::string >::key_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_map_Sl_std_string_Sc_std_string_Sg____contains__(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_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_StringMap_key_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 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__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap_key_iterator" "', argument " "1"" of type '" "std::map< std::string,std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (swig::SwigPyIterator *)std_map_Sl_std_string_Sc_std_string_Sg__key_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_StringMap_value_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 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__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap_value_iterator" "', argument " "1"" of type '" "std::map< std::string,std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (swig::SwigPyIterator *)std_map_Sl_std_string_Sc_std_string_Sg__value_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_StringMap___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 0 ;
  std::map< std::string,std::string >::key_type *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_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap___setitem__" "', argument " "1"" of type '" "std::map< std::string,std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(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 '" "StringMap___setitem__" "', argument " "2"" of type '" "std::map< std::string,std::string >::key_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringMap___setitem__" "', argument " "2"" of type '" "std::map< std::string,std::string >::key_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_map_Sl_std_string_Sc_std_string_Sg____setitem____SWIG_0(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_StringMap___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 0 ;
  std::map< std::string,std::string >::key_type *arg2 = 0 ;
  std::map< std::string,std::string >::mapped_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  int res3 = SWIG_OLDOBJ ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap___setitem__" "', argument " "1"" of type '" "std::map< std::string,std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(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 '" "StringMap___setitem__" "', argument " "2"" of type '" "std::map< std::string,std::string >::key_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringMap___setitem__" "', argument " "2"" of type '" "std::map< std::string,std::string >::key_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    std::string *ptr = (std::string *)0;
    res3 = SWIG_AsPtr_std_string(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringMap___setitem__" "', argument " "3"" of type '" "std::map< std::string,std::string >::mapped_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringMap___setitem__" "', argument " "3"" of type '" "std::map< std::string,std::string >::mapped_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_map_Sl_std_string_Sc_std_string_Sg____setitem____SWIG_1(arg1,(std::string const &)*arg2,(std::string 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();
  if (SWIG_IsNewObj(res2)) delete arg2;
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringMap___setitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"StringMap___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::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _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_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::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >**)(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;
      {
        int res = SWIG_AsPtr_std_string(argv[2], (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_StringMap___setitem____SWIG_0(self, argc, argv);
    case 2:
      return _wrap_StringMap___setitem____SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringMap___setitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::map< std::string,std::string >::__setitem__(std::map< std::string,std::string >::key_type const &)\n"
    "    std::map< std::string,std::string >::__setitem__(std::map< std::string,std::string >::key_type const &,std::map< std::string,std::string >::mapped_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_StringMap_asdict(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 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_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap_asdict" "', argument " "1"" of type '" "std::map< std::string,std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)std_map_Sl_std_string_Sc_std_string_Sg__asdict(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_new_StringMap__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *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::map< std::string,std::string > *)new std::map< std::string,std::string >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_StringMap__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  std::map< std::string,std::string > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  {
    std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > *ptr = (std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > *)0;
    res1 = swig::asptr(swig_obj[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_StringMap" "', argument " "1"" of type '" "std::map< std::string,std::string > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_StringMap" "', argument " "1"" of type '" "std::map< std::string,std::string > const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::map< std::string,std::string > *)new std::map< std::string,std::string >((std::map< std::string,std::string > 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__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_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_new_StringMap(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[2];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_StringMap",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_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__lessT_std__string_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 == 1) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >**)(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_StringMap__SWIG_1(self, argc, argv);
    case 2:
      return _wrap_new_StringMap__SWIG_0(self, argc, argv);
    case 3:
      return _wrap_new_StringMap__SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_StringMap'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::map< std::string,std::string >::map(std::less< std::string > const &)\n"
    "    std::map< std::string,std::string >::map()\n"
    "    std::map< std::string,std::string >::map(std::map< std::string,std::string > const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_StringMap_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 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__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap_empty" "', argument " "1"" of type '" "std::map< std::string,std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((std::map< std::string,std::string > 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_StringMap_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::map< std::string,std::string >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap_size" "', argument " "1"" of type '" "std::map< std::string,std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::map< std::string,std::string > 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_StringMap_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 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__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap_clear" "', argument " "1"" of type '" "std::map< std::string,std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(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_StringMap_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 0 ;
  std::map< std::string,std::string > *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:StringMap_swap",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap_swap" "', argument " "1"" of type '" "std::map< std::string,std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "StringMap_swap" "', argument " "2"" of type '" "std::map< std::string,std::string > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringMap_swap" "', argument " "2"" of type '" "std::map< std::string,std::string > &""'"); 
  }
  arg2 = reinterpret_cast< std::map< std::string,std::string > * >(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_StringMap_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::allocator< std::pair< std::string const,std::string > > > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap_get_allocator" "', argument " "1"" of type '" "std::map< std::string,std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::map< std::string,std::string > 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::map< std::string,std::string >::allocator_type(static_cast< const std::map< std::string,std::string >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__pairT_std__string_const_std__string_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringMap_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::map< std::string,std::string >::iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap_begin" "', argument " "1"" of type '" "std::map< std::string,std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(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::map< std::string,std::string >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringMap_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::map< std::string,std::string >::iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap_end" "', argument " "1"" of type '" "std::map< std::string,std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(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::map< std::string,std::string >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringMap_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::map< std::string,std::string >::reverse_iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap_rbegin" "', argument " "1"" of type '" "std::map< std::string,std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(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::map< std::string,std::string >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringMap_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::map< std::string,std::string >::reverse_iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap_rend" "', argument " "1"" of type '" "std::map< std::string,std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(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::map< std::string,std::string >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringMap_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 0 ;
  std::map< std::string,std::string >::key_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  std::map< std::string,std::string >::size_type result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap_erase" "', argument " "1"" of type '" "std::map< std::string,std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(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 '" "StringMap_erase" "', argument " "2"" of type '" "std::map< std::string,std::string >::key_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringMap_erase" "', argument " "2"" of type '" "std::map< std::string,std::string >::key_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->erase((std::map< std::string,std::string >::key_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_From_size_t(static_cast< size_t >(result));
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringMap_count(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 0 ;
  std::map< std::string,std::string >::key_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  std::map< std::string,std::string >::size_type result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:StringMap_count",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap_count" "', argument " "1"" of type '" "std::map< std::string,std::string > const *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(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 '" "StringMap_count" "', argument " "2"" of type '" "std::map< std::string,std::string >::key_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringMap_count" "', argument " "2"" of type '" "std::map< std::string,std::string >::key_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::map< std::string,std::string > const *)arg1)->count((std::map< std::string,std::string >::key_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_From_size_t(static_cast< size_t >(result));
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringMap_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 0 ;
  std::map< std::string,std::string >::iterator arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap_erase" "', argument " "1"" of type '" "std::map< std::string,std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(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 '" "StringMap_erase" "', argument " "2"" of type '" "std::map< std::string,std::string >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::map< std::string,std::string >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< std::string,std::string >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringMap_erase" "', argument " "2"" of type '" "std::map< std::string,std::string >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_map_Sl_std_string_Sc_std_string_Sg__erase__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_StringMap_erase__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 0 ;
  std::map< std::string,std::string >::iterator arg2 ;
  std::map< std::string,std::string >::iterator arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  swig::SwigPyIterator *iter3 = 0 ;
  int res3 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap_erase" "', argument " "1"" of type '" "std::map< std::string,std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(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 '" "StringMap_erase" "', argument " "2"" of type '" "std::map< std::string,std::string >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::map< std::string,std::string >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< std::string,std::string >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringMap_erase" "', argument " "2"" of type '" "std::map< std::string,std::string >::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 '" "StringMap_erase" "', argument " "3"" of type '" "std::map< std::string,std::string >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::map< std::string,std::string >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< std::string,std::string >::iterator > *>(iter3);
    if (iter_t) {
      arg3 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringMap_erase" "', argument " "3"" of type '" "std::map< std::string,std::string >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_map_Sl_std_string_Sc_std_string_Sg__erase__SWIG_2(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_StringMap_erase(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"StringMap_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::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >**)(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::map< std::string,std::string >::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 == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >**)(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:
    
    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::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_3;
      _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::map< std::string,std::string >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_3;
      _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::map< std::string,std::string >::iterator > *>(iter) != 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_StringMap_erase__SWIG_1(self, argc, argv);
    case 2:
      return _wrap_StringMap_erase__SWIG_0(self, argc, argv);
    case 3:
      return _wrap_StringMap_erase__SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringMap_erase'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::map< std::string,std::string >::erase(std::map< std::string,std::string >::key_type const &)\n"
    "    std::map< std::string,std::string >::erase(std::map< std::string,std::string >::iterator)\n"
    "    std::map< std::string,std::string >::erase(std::map< std::string,std::string >::iterator,std::map< std::string,std::string >::iterator)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_StringMap_find(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 0 ;
  std::map< std::string,std::string >::key_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  std::map< std::string,std::string >::iterator result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:StringMap_find",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap_find" "', argument " "1"" of type '" "std::map< std::string,std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(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 '" "StringMap_find" "', argument " "2"" of type '" "std::map< std::string,std::string >::key_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringMap_find" "', argument " "2"" of type '" "std::map< std::string,std::string >::key_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->find((std::map< std::string,std::string >::key_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::make_output_iterator(static_cast< const std::map< std::string,std::string >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringMap_lower_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 0 ;
  std::map< std::string,std::string >::key_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  std::map< std::string,std::string >::iterator result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:StringMap_lower_bound",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap_lower_bound" "', argument " "1"" of type '" "std::map< std::string,std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(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 '" "StringMap_lower_bound" "', argument " "2"" of type '" "std::map< std::string,std::string >::key_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringMap_lower_bound" "', argument " "2"" of type '" "std::map< std::string,std::string >::key_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->lower_bound((std::map< std::string,std::string >::key_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::make_output_iterator(static_cast< const std::map< std::string,std::string >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringMap_upper_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 0 ;
  std::map< std::string,std::string >::key_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  std::map< std::string,std::string >::iterator result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:StringMap_upper_bound",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMap_upper_bound" "', argument " "1"" of type '" "std::map< std::string,std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(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 '" "StringMap_upper_bound" "', argument " "2"" of type '" "std::map< std::string,std::string >::key_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringMap_upper_bound" "', argument " "2"" of type '" "std::map< std::string,std::string >::key_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->upper_bound((std::map< std::string,std::string >::key_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::make_output_iterator(static_cast< const std::map< std::string,std::string >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_StringMap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::map< std::string,std::string > *arg1 = (std::map< std::string,std::string > *) 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__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_StringMap" "', argument " "1"" of type '" "std::map< std::string,std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::map< std::string,std::string > * >(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 *StringMap_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__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new_StringStringPair__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  std::pair< std::string,std::string > *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::pair< std::string,std::string > *)new std::pair< std::string,std::string >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__pairT_std__string_std__string_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_StringStringPair__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::string arg1 ;
  std::string arg2 ;
  std::pair< std::string,std::string > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  {
    std::string *ptr = (std::string *)0;
    int res = SWIG_AsPtr_std_string(swig_obj[0], &ptr);
    if (!SWIG_IsOK(res) || !ptr) {
      SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "new_StringStringPair" "', argument " "1"" of type '" "std::string""'"); 
    }
    arg1 = *ptr;
    if (SWIG_IsNewObj(res)) delete ptr;
  }
  {
    std::string *ptr = (std::string *)0;
    int res = SWIG_AsPtr_std_string(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res) || !ptr) {
      SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "new_StringStringPair" "', 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
    {
      result = (std::pair< std::string,std::string > *)new std::pair< std::string,std::string >(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_std__pairT_std__string_std__string_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_StringStringPair__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::pair< std::string,std::string > *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  std::pair< std::string,std::string > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  {
    std::pair<std::string,std::string > *ptr = (std::pair<std::string,std::string > *)0;
    res1 = swig::asptr(swig_obj[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_StringStringPair" "', argument " "1"" of type '" "std::pair< std::string,std::string > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_StringStringPair" "', argument " "1"" of type '" "std::pair< std::string,std::string > const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::pair< std::string,std::string > *)new std::pair< std::string,std::string >((std::pair< std::string,std::string > 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__pairT_std__string_std__string_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_new_StringStringPair(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_StringStringPair",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::asptr(argv[0], (std::pair<std::string,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:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_3;
      _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_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_StringStringPair__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_StringStringPair__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_new_StringStringPair__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_StringStringPair'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::pair< std::string,std::string >::pair()\n"
    "    std::pair< std::string,std::string >::pair(std::string,std::string)\n"
    "    std::pair< std::string,std::string >::pair(std::pair< std::string,std::string > const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_StringStringPair_first_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::pair< std::string,std::string > *arg1 = (std::pair< std::string,std::string > *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"StringStringPair_first_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__pairT_std__string_std__string_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringPair_first_set" "', argument " "1"" of type '" "std::pair< std::string,std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::pair< std::string,std::string > * >(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 '" "StringStringPair_first_set" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringStringPair_first_set" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    arg2 = ptr;
  }
  if (arg1) (arg1)->first = *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_StringStringPair_first_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::pair< std::string,std::string > *arg1 = (std::pair< std::string,std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::string *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__pairT_std__string_std__string_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringPair_first_get" "', argument " "1"" of type '" "std::pair< std::string,std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::pair< std::string,std::string > * >(argp1);
  result = (std::string *) & ((arg1)->first);
  resultobj = SWIG_From_std_string(static_cast< std::string >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringStringPair_second_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::pair< std::string,std::string > *arg1 = (std::pair< std::string,std::string > *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"StringStringPair_second_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__pairT_std__string_std__string_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringPair_second_set" "', argument " "1"" of type '" "std::pair< std::string,std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::pair< std::string,std::string > * >(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 '" "StringStringPair_second_set" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringStringPair_second_set" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    arg2 = ptr;
  }
  if (arg1) (arg1)->second = *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_StringStringPair_second_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::pair< std::string,std::string > *arg1 = (std::pair< std::string,std::string > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::string *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__pairT_std__string_std__string_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringPair_second_get" "', argument " "1"" of type '" "std::pair< std::string,std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::pair< std::string,std::string > * >(argp1);
  result = (std::string *) & ((arg1)->second);
  resultobj = SWIG_From_std_string(static_cast< std::string >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_StringStringPair(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::pair< std::string,std::string > *arg1 = (std::pair< std::string,std::string > *) 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__pairT_std__string_std__string_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_StringStringPair" "', argument " "1"" of type '" "std::pair< std::string,std::string > *""'"); 
  }
  arg1 = reinterpret_cast< std::pair< std::string,std::string > * >(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 *StringStringPair_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__pairT_std__string_std__string_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_StringStringList_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 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_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList_iterator" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (swig::SwigPyIterator *)std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__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_StringStringList___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 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_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList___nonzero__" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__Sg____nonzero__((std::vector< std::pair< std::string,std::string > > 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_StringStringList___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 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_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList___bool__" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__Sg____bool__((std::vector< std::pair< std::string,std::string > > 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_StringStringList___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::pair< std::string,std::string > >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList___len__" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__Sg____len__((std::vector< std::pair< std::string,std::string > > 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_StringStringList_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::pair< std::string,std::string > >::value_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList_pop" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__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(static_cast< std::pair<std::string,std::string > >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringStringList___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 0 ;
  std::vector< std::pair< std::string,std::string > >::difference_type arg2 ;
  std::vector< std::pair< std::string,std::string > >::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< std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > > *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:StringStringList___getslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList___getslice__" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringStringList___getslice__" "', argument " "2"" of type '" "std::vector< std::pair< std::string,std::string > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< std::string,std::string > >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringStringList___getslice__" "', argument " "3"" of type '" "std::vector< std::pair< std::string,std::string > >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< std::pair< std::string,std::string > >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > > *)std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__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_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringStringList___setslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 0 ;
  std::vector< std::pair< std::string,std::string > >::difference_type arg2 ;
  std::vector< std::pair< std::string,std::string > >::difference_type arg3 ;
  std::vector< std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > > const &arg4_defvalue = std::vector< std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > >() ;
  std::vector< std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > > *arg4 = (std::vector< std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > > *) &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:StringStringList___setslice__",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList___setslice__" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringStringList___setslice__" "', argument " "2"" of type '" "std::vector< std::pair< std::string,std::string > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< std::string,std::string > >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringStringList___setslice__" "', argument " "3"" of type '" "std::vector< std::pair< std::string,std::string > >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< std::pair< std::string,std::string > >::difference_type >(val3);
  if (obj3) {
    {
      std::vector<std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > > *ptr = (std::vector<std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > > *)0;
      res4 = swig::asptr(obj3, &ptr);
      if (!SWIG_IsOK(res4)) {
        SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "StringStringList___setslice__" "', argument " "4"" of type '" "std::vector< std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > > const &""'"); 
      }
      if (!ptr) {
        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringStringList___setslice__" "', argument " "4"" of type '" "std::vector< std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > > const &""'"); 
      }
      arg4 = ptr;
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__Sg____setslice__(arg1,arg2,arg3,(std::vector< std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > > 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_StringStringList___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 0 ;
  std::vector< std::pair< std::string,std::string > >::difference_type arg2 ;
  std::vector< std::pair< std::string,std::string > >::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:StringStringList___delslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList___delslice__" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringStringList___delslice__" "', argument " "2"" of type '" "std::vector< std::pair< std::string,std::string > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< std::string,std::string > >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringStringList___delslice__" "', argument " "3"" of type '" "std::vector< std::pair< std::string,std::string > >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< std::pair< std::string,std::string > >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__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_StringStringList___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 0 ;
  std::vector< std::pair< std::string,std::string > >::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_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList___delitem__" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringStringList___delitem__" "', argument " "2"" of type '" "std::vector< std::pair< std::string,std::string > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< std::string,std::string > >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__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_StringStringList___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList___getitem__" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringStringList___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< std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > > *)std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__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_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringStringList___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  std::vector< std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > > *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_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList___setitem__" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringStringList___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    std::vector<std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > > *ptr = (std::vector<std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringStringList___setitem__" "', argument " "3"" of type '" "std::vector< std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringStringList___setitem__" "', argument " "3"" of type '" "std::vector< std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > > const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__Sg____setitem____SWIG_0(arg1,arg2,(std::vector< std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > > 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_StringStringList___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 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_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList___setitem__" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringStringList___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_std_pair_Sl_std_string_Sc_std_string_Sg__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_StringStringList___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 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_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList___delitem__" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringStringList___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_std_pair_Sl_std_string_Sc_std_string_Sg__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_StringStringList___delitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"StringStringList___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<std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > >**)(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<std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > >**)(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_StringStringList___delitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_StringStringList___delitem____SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringStringList___delitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::pair< std::string,std::string > >::__delitem__(std::vector< std::pair< std::string,std::string > >::difference_type)\n"
    "    std::vector< std::pair< std::string,std::string > >::__delitem__(PySliceObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_StringStringList___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 0 ;
  std::vector< std::pair< std::string,std::string > >::difference_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  std::vector< std::pair< std::string,std::string > >::value_type *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList___getitem__" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringStringList___getitem__" "', argument " "2"" of type '" "std::vector< std::pair< std::string,std::string > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< std::string,std::string > >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< std::pair< std::string,std::string > >::value_type *) &std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__Sg____getitem____SWIG_1((std::vector< std::pair< std::string,std::string > > 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(static_cast< std::pair<std::string,std::string > >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringStringList___getitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"StringStringList___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<std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > >**)(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<std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > >**)(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_StringStringList___getitem____SWIG_0(self, argc, argv);
    case 2:
      return _wrap_StringStringList___getitem____SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringStringList___getitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::pair< std::string,std::string > >::__getitem__(PySliceObject *)\n"
    "    std::vector< std::pair< std::string,std::string > >::__getitem__(std::vector< std::pair< std::string,std::string > >::difference_type) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_StringStringList___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 0 ;
  std::vector< std::pair< std::string,std::string > >::difference_type arg2 ;
  std::vector< std::pair< std::string,std::string > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList___setitem__" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringStringList___setitem__" "', argument " "2"" of type '" "std::vector< std::pair< std::string,std::string > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< std::string,std::string > >::difference_type >(val2);
  {
    std::pair<std::string,std::string > *ptr = (std::pair<std::string,std::string > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringStringList___setitem__" "', argument " "3"" of type '" "std::vector< std::pair< std::string,std::string > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringStringList___setitem__" "', argument " "3"" of type '" "std::vector< std::pair< std::string,std::string > >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__Sg____setitem____SWIG_2(arg1,arg2,(std::pair< std::string,std::string > 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();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringStringList___setitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"StringStringList___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<std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > >**)(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<std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > >**)(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<std::pair< std::string,std::string >,std::allocator< std::pair< std::string,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:
    
    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<std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > >**)(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::asptr(argv[2], (std::pair<std::string,std::string >**)(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_StringStringList___setitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_StringStringList___setitem____SWIG_0(self, argc, argv);
    case 3:
      return _wrap_StringStringList___setitem____SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringStringList___setitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::pair< std::string,std::string > >::__setitem__(PySliceObject *,std::vector< std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > > const &)\n"
    "    std::vector< std::pair< std::string,std::string > >::__setitem__(PySliceObject *)\n"
    "    std::vector< std::pair< std::string,std::string > >::__setitem__(std::vector< std::pair< std::string,std::string > >::difference_type,std::vector< std::pair< std::string,std::string > >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_StringStringList_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 0 ;
  std::vector< std::pair< std::string,std::string > >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:StringStringList_append",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList_append" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(argp1);
  {
    std::pair<std::string,std::string > *ptr = (std::pair<std::string,std::string > *)0;
    res2 = swig::asptr(obj1, &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "StringStringList_append" "', argument " "2"" of type '" "std::vector< std::pair< std::string,std::string > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringStringList_append" "', argument " "2"" of type '" "std::vector< std::pair< std::string,std::string > >::value_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__Sg__append(arg1,(std::pair< std::string,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_new_StringStringList__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *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< std::pair< std::string,std::string > > *)new std::vector< std::pair< std::string,std::string > >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_StringStringList__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  std::vector< std::pair< std::string,std::string > > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  {
    std::vector<std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > > *ptr = (std::vector<std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > > *)0;
    res1 = swig::asptr(swig_obj[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_StringStringList" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_StringStringList" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::pair< std::string,std::string > > *)new std::vector< std::pair< std::string,std::string > >((std::vector< std::pair< std::string,std::string > > 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_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_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_StringStringList_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 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_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList_empty" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((std::vector< std::pair< std::string,std::string > > 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_StringStringList_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::pair< std::string,std::string > >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList_size" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< std::pair< std::string,std::string > > 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_StringStringList_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 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_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList_clear" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(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_StringStringList_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 0 ;
  std::vector< std::pair< std::string,std::string > > *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:StringStringList_swap",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList_swap" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "StringStringList_swap" "', argument " "2"" of type '" "std::vector< std::pair< std::string,std::string > > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringStringList_swap" "', argument " "2"" of type '" "std::vector< std::pair< std::string,std::string > > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(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_StringStringList_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::allocator< std::pair< std::string,std::string > > > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList_get_allocator" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< std::pair< std::string,std::string > > 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< std::pair< std::string,std::string > >::allocator_type(static_cast< const std::vector< std::pair< std::string,std::string > >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__pairT_std__string_std__string_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringStringList_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::pair< std::string,std::string > >::iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList_begin" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(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< std::pair< std::string,std::string > >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringStringList_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::pair< std::string,std::string > >::iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList_end" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(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< std::pair< std::string,std::string > >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringStringList_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::pair< std::string,std::string > >::reverse_iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList_rbegin" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(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< std::pair< std::string,std::string > >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringStringList_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::pair< std::string,std::string > >::reverse_iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList_rend" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(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< std::pair< std::string,std::string > >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_StringStringList__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > >::size_type arg1 ;
  size_t val1 ;
  int ecode1 = 0 ;
  std::vector< std::pair< std::string,std::string > > *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_StringStringList" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > >::size_type""'");
  } 
  arg1 = static_cast< std::vector< std::pair< std::string,std::string > >::size_type >(val1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::pair< std::string,std::string > > *)new std::vector< std::pair< std::string,std::string > >(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_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringStringList_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 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_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList_pop_back" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(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_StringStringList_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 0 ;
  std::vector< std::pair< std::string,std::string > >::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_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList_resize" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringStringList_resize" "', argument " "2"" of type '" "std::vector< std::pair< std::string,std::string > >::size_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< std::string,std::string > >::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_StringStringList_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 0 ;
  std::vector< std::pair< std::string,std::string > >::iterator arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  std::vector< std::pair< std::string,std::string > >::iterator result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList_erase" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(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 '" "StringStringList_erase" "', argument " "2"" of type '" "std::vector< std::pair< std::string,std::string > >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::pair< std::string,std::string > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::pair< std::string,std::string > >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringStringList_erase" "', argument " "2"" of type '" "std::vector< std::pair< std::string,std::string > >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__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< std::pair< std::string,std::string > >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringStringList_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 0 ;
  std::vector< std::pair< std::string,std::string > >::iterator arg2 ;
  std::vector< std::pair< std::string,std::string > >::iterator arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  swig::SwigPyIterator *iter3 = 0 ;
  int res3 ;
  std::vector< std::pair< std::string,std::string > >::iterator result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList_erase" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(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 '" "StringStringList_erase" "', argument " "2"" of type '" "std::vector< std::pair< std::string,std::string > >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::pair< std::string,std::string > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::pair< std::string,std::string > >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringStringList_erase" "', argument " "2"" of type '" "std::vector< std::pair< std::string,std::string > >::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 '" "StringStringList_erase" "', argument " "3"" of type '" "std::vector< std::pair< std::string,std::string > >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::pair< std::string,std::string > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::pair< std::string,std::string > >::iterator > *>(iter3);
    if (iter_t) {
      arg3 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringStringList_erase" "', argument " "3"" of type '" "std::vector< std::pair< std::string,std::string > >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__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< std::pair< std::string,std::string > >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringStringList_erase(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"StringStringList_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<std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > >**)(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< std::pair< std::string,std::string > >::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<std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > >**)(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< std::pair< std::string,std::string > >::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< std::pair< std::string,std::string > >::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_StringStringList_erase__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_StringStringList_erase__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringStringList_erase'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::pair< std::string,std::string > >::erase(std::vector< std::pair< std::string,std::string > >::iterator)\n"
    "    std::vector< std::pair< std::string,std::string > >::erase(std::vector< std::pair< std::string,std::string > >::iterator,std::vector< std::pair< std::string,std::string > >::iterator)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_new_StringStringList__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > >::size_type arg1 ;
  std::vector< std::pair< std::string,std::string > >::value_type *arg2 = 0 ;
  size_t val1 ;
  int ecode1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  std::vector< std::pair< std::string,std::string > > *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_StringStringList" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > >::size_type""'");
  } 
  arg1 = static_cast< std::vector< std::pair< std::string,std::string > >::size_type >(val1);
  {
    std::pair<std::string,std::string > *ptr = (std::pair<std::string,std::string > *)0;
    res2 = swig::asptr(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_StringStringList" "', argument " "2"" of type '" "std::vector< std::pair< std::string,std::string > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_StringStringList" "', argument " "2"" of type '" "std::vector< std::pair< std::string,std::string > >::value_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::pair< std::string,std::string > > *)new std::vector< std::pair< std::string,std::string > >(arg1,(std::vector< std::pair< std::string,std::string > >::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_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, SWIG_POINTER_NEW |  0 );
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_StringStringList(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_StringStringList",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<std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > >**)(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::asptr(argv[1], (std::pair<std::string,std::string >**)(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_StringStringList__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_StringStringList__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_new_StringStringList__SWIG_1(self, argc, argv);
    case 4:
      return _wrap_new_StringStringList__SWIG_3(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_StringStringList'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::pair< std::string,std::string > >::vector()\n"
    "    std::vector< std::pair< std::string,std::string > >::vector(std::vector< std::pair< std::string,std::string > > const &)\n"
    "    std::vector< std::pair< std::string,std::string > >::vector(std::vector< std::pair< std::string,std::string > >::size_type)\n"
    "    std::vector< std::pair< std::string,std::string > >::vector(std::vector< std::pair< std::string,std::string > >::size_type,std::vector< std::pair< std::string,std::string > >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_StringStringList_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 0 ;
  std::vector< std::pair< std::string,std::string > >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:StringStringList_push_back",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList_push_back" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(argp1);
  {
    std::pair<std::string,std::string > *ptr = (std::pair<std::string,std::string > *)0;
    res2 = swig::asptr(obj1, &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "StringStringList_push_back" "', argument " "2"" of type '" "std::vector< std::pair< std::string,std::string > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringStringList_push_back" "', argument " "2"" of type '" "std::vector< std::pair< std::string,std::string > >::value_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->push_back((std::vector< std::pair< std::string,std::string > >::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();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringStringList_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::pair< std::string,std::string > >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList_front" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::pair< std::string,std::string > >::value_type *) &((std::vector< std::pair< std::string,std::string > > 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(static_cast< std::pair<std::string,std::string > >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringStringList_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::pair< std::string,std::string > >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList_back" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::pair< std::string,std::string > >::value_type *) &((std::vector< std::pair< std::string,std::string > > 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(static_cast< std::pair<std::string,std::string > >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringStringList_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 0 ;
  std::vector< std::pair< std::string,std::string > >::size_type arg2 ;
  std::vector< std::pair< std::string,std::string > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  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:StringStringList_assign",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList_assign" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringStringList_assign" "', argument " "2"" of type '" "std::vector< std::pair< std::string,std::string > >::size_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< std::string,std::string > >::size_type >(val2);
  {
    std::pair<std::string,std::string > *ptr = (std::pair<std::string,std::string > *)0;
    res3 = swig::asptr(obj2, &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringStringList_assign" "', argument " "3"" of type '" "std::vector< std::pair< std::string,std::string > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringStringList_assign" "', argument " "3"" of type '" "std::vector< std::pair< std::string,std::string > >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->assign(arg2,(std::vector< std::pair< std::string,std::string > >::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();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringStringList_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 0 ;
  std::vector< std::pair< std::string,std::string > >::size_type arg2 ;
  std::vector< std::pair< std::string,std::string > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList_resize" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringStringList_resize" "', argument " "2"" of type '" "std::vector< std::pair< std::string,std::string > >::size_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< std::string,std::string > >::size_type >(val2);
  {
    std::pair<std::string,std::string > *ptr = (std::pair<std::string,std::string > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringStringList_resize" "', argument " "3"" of type '" "std::vector< std::pair< std::string,std::string > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringStringList_resize" "', argument " "3"" of type '" "std::vector< std::pair< std::string,std::string > >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resize(arg2,(std::vector< std::pair< std::string,std::string > >::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();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringStringList_resize(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"StringStringList_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<std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > >**)(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<std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > >**)(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::asptr(argv[2], (std::pair<std::string,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_StringStringList_resize__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_StringStringList_resize__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringStringList_resize'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::pair< std::string,std::string > >::resize(std::vector< std::pair< std::string,std::string > >::size_type)\n"
    "    std::vector< std::pair< std::string,std::string > >::resize(std::vector< std::pair< std::string,std::string > >::size_type,std::vector< std::pair< std::string,std::string > >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_StringStringList_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 0 ;
  std::vector< std::pair< std::string,std::string > >::iterator arg2 ;
  std::vector< std::pair< std::string,std::string > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  int res3 = SWIG_OLDOBJ ;
  std::vector< std::pair< std::string,std::string > >::iterator result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList_insert" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(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 '" "StringStringList_insert" "', argument " "2"" of type '" "std::vector< std::pair< std::string,std::string > >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::pair< std::string,std::string > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::pair< std::string,std::string > >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringStringList_insert" "', argument " "2"" of type '" "std::vector< std::pair< std::string,std::string > >::iterator""'");
    }
  }
  {
    std::pair<std::string,std::string > *ptr = (std::pair<std::string,std::string > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringStringList_insert" "', argument " "3"" of type '" "std::vector< std::pair< std::string,std::string > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringStringList_insert" "', argument " "3"" of type '" "std::vector< std::pair< std::string,std::string > >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__Sg__insert__SWIG_0(arg1,arg2,(std::pair< std::string,std::string > 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< std::pair< std::string,std::string > >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringStringList_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 0 ;
  std::vector< std::pair< std::string,std::string > >::iterator arg2 ;
  std::vector< std::pair< std::string,std::string > >::size_type arg3 ;
  std::vector< std::pair< std::string,std::string > >::value_type *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  size_t val3 ;
  int ecode3 = 0 ;
  int res4 = SWIG_OLDOBJ ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList_insert" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(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 '" "StringStringList_insert" "', argument " "2"" of type '" "std::vector< std::pair< std::string,std::string > >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::pair< std::string,std::string > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::pair< std::string,std::string > >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringStringList_insert" "', argument " "2"" of type '" "std::vector< std::pair< std::string,std::string > >::iterator""'");
    }
  }
  ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringStringList_insert" "', argument " "3"" of type '" "std::vector< std::pair< std::string,std::string > >::size_type""'");
  } 
  arg3 = static_cast< std::vector< std::pair< std::string,std::string > >::size_type >(val3);
  {
    std::pair<std::string,std::string > *ptr = (std::pair<std::string,std::string > *)0;
    res4 = swig::asptr(swig_obj[3], &ptr);
    if (!SWIG_IsOK(res4)) {
      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "StringStringList_insert" "', argument " "4"" of type '" "std::vector< std::pair< std::string,std::string > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringStringList_insert" "', argument " "4"" of type '" "std::vector< std::pair< std::string,std::string > >::value_type const &""'"); 
    }
    arg4 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_vector_Sl_std_pair_Sl_std_string_Sc_std_string_Sg__Sg__insert__SWIG_1(arg1,arg2,arg3,(std::pair< std::string,std::string > 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_StringStringList_insert(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"StringStringList_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<std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > >**)(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< std::pair< std::string,std::string > >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = swig::asptr(argv[2], (std::pair<std::string,std::string >**)(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;
      {
        int res = swig::asptr(argv[0], (std::vector<std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > >**)(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< std::pair< std::string,std::string > >::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::asptr(argv[3], (std::pair<std::string,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_StringStringList_insert__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_StringStringList_insert__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringStringList_insert'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::pair< std::string,std::string > >::insert(std::vector< std::pair< std::string,std::string > >::iterator,std::vector< std::pair< std::string,std::string > >::value_type const &)\n"
    "    std::vector< std::pair< std::string,std::string > >::insert(std::vector< std::pair< std::string,std::string > >::iterator,std::vector< std::pair< std::string,std::string > >::size_type,std::vector< std::pair< std::string,std::string > >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_StringStringList_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 0 ;
  std::vector< std::pair< std::string,std::string > >::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:StringStringList_reserve",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList_reserve" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringStringList_reserve" "', argument " "2"" of type '" "std::vector< std::pair< std::string,std::string > >::size_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< std::string,std::string > >::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_StringStringList_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::pair< std::string,std::string > >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringStringList_capacity" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< std::pair< std::string,std::string > > 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_StringStringList(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< std::string,std::string > > *arg1 = (std::vector< std::pair< std::string,std::string > > *) 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_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_StringStringList" "', argument " "1"" of type '" "std::vector< std::pair< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< std::string,std::string > > * >(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 *StringStringList_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_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_StringMapList_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 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_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList_iterator" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (swig::SwigPyIterator *)std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__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_StringMapList___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 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_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList___nonzero__" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__Sg____nonzero__((std::vector< std::map< std::string,std::string > > 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_StringMapList___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 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_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList___bool__" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__Sg____bool__((std::vector< std::map< std::string,std::string > > 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_StringMapList___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::map< std::string,std::string > >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList___len__" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__Sg____len__((std::vector< std::map< std::string,std::string > > 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_StringMapList_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::map< std::string,std::string > >::value_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList_pop" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__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(static_cast< std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringMapList___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 0 ;
  std::vector< std::map< std::string,std::string > >::difference_type arg2 ;
  std::vector< std::map< std::string,std::string > >::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< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > > *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:StringMapList___getslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList___getslice__" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringMapList___getslice__" "', argument " "2"" of type '" "std::vector< std::map< std::string,std::string > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::map< std::string,std::string > >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringMapList___getslice__" "', argument " "3"" of type '" "std::vector< std::map< std::string,std::string > >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< std::map< std::string,std::string > >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > > *)std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__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_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringMapList___setslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 0 ;
  std::vector< std::map< std::string,std::string > >::difference_type arg2 ;
  std::vector< std::map< std::string,std::string > >::difference_type arg3 ;
  std::vector< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > > const &arg4_defvalue = std::vector< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > >() ;
  std::vector< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > > *arg4 = (std::vector< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > > *) &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:StringMapList___setslice__",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList___setslice__" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringMapList___setslice__" "', argument " "2"" of type '" "std::vector< std::map< std::string,std::string > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::map< std::string,std::string > >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringMapList___setslice__" "', argument " "3"" of type '" "std::vector< std::map< std::string,std::string > >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< std::map< std::string,std::string > >::difference_type >(val3);
  if (obj3) {
    {
      std::vector<std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > > *ptr = (std::vector<std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > > *)0;
      res4 = swig::asptr(obj3, &ptr);
      if (!SWIG_IsOK(res4)) {
        SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "StringMapList___setslice__" "', argument " "4"" of type '" "std::vector< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > > const &""'"); 
      }
      if (!ptr) {
        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringMapList___setslice__" "', argument " "4"" of type '" "std::vector< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > > const &""'"); 
      }
      arg4 = ptr;
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__Sg____setslice__(arg1,arg2,arg3,(std::vector< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > > 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_StringMapList___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 0 ;
  std::vector< std::map< std::string,std::string > >::difference_type arg2 ;
  std::vector< std::map< std::string,std::string > >::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:StringMapList___delslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList___delslice__" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringMapList___delslice__" "', argument " "2"" of type '" "std::vector< std::map< std::string,std::string > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::map< std::string,std::string > >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringMapList___delslice__" "', argument " "3"" of type '" "std::vector< std::map< std::string,std::string > >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< std::map< std::string,std::string > >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__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_StringMapList___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 0 ;
  std::vector< std::map< std::string,std::string > >::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_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList___delitem__" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringMapList___delitem__" "', argument " "2"" of type '" "std::vector< std::map< std::string,std::string > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::map< std::string,std::string > >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__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_StringMapList___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList___getitem__" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringMapList___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< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > > *)std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__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_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringMapList___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  std::vector< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > > *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_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList___setitem__" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringMapList___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    std::vector<std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > > *ptr = (std::vector<std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringMapList___setitem__" "', argument " "3"" of type '" "std::vector< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringMapList___setitem__" "', argument " "3"" of type '" "std::vector< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > > const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__Sg____setitem____SWIG_0(arg1,arg2,(std::vector< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > > 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_StringMapList___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 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_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList___setitem__" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringMapList___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_std_map_Sl_std_string_Sc_std_string_Sg__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_StringMapList___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 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_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList___delitem__" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringMapList___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_std_map_Sl_std_string_Sc_std_string_Sg__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_StringMapList___delitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"StringMapList___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<std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > >**)(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<std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > >**)(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_StringMapList___delitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_StringMapList___delitem____SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringMapList___delitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::map< std::string,std::string > >::__delitem__(std::vector< std::map< std::string,std::string > >::difference_type)\n"
    "    std::vector< std::map< std::string,std::string > >::__delitem__(PySliceObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_StringMapList___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 0 ;
  std::vector< std::map< std::string,std::string > >::difference_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  std::vector< std::map< std::string,std::string > >::value_type *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList___getitem__" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringMapList___getitem__" "', argument " "2"" of type '" "std::vector< std::map< std::string,std::string > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::map< std::string,std::string > >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< std::map< std::string,std::string > >::value_type *) &std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__Sg____getitem____SWIG_1((std::vector< std::map< std::string,std::string > > 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(static_cast< std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringMapList___getitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"StringMapList___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<std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > >**)(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<std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > >**)(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_StringMapList___getitem____SWIG_0(self, argc, argv);
    case 2:
      return _wrap_StringMapList___getitem____SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringMapList___getitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::map< std::string,std::string > >::__getitem__(PySliceObject *)\n"
    "    std::vector< std::map< std::string,std::string > >::__getitem__(std::vector< std::map< std::string,std::string > >::difference_type) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_StringMapList___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 0 ;
  std::vector< std::map< std::string,std::string > >::difference_type arg2 ;
  std::vector< std::map< std::string,std::string > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList___setitem__" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringMapList___setitem__" "', argument " "2"" of type '" "std::vector< std::map< std::string,std::string > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::map< std::string,std::string > >::difference_type >(val2);
  {
    std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > *ptr = (std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringMapList___setitem__" "', argument " "3"" of type '" "std::vector< std::map< std::string,std::string > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringMapList___setitem__" "', argument " "3"" of type '" "std::vector< std::map< std::string,std::string > >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__Sg____setitem____SWIG_2(arg1,arg2,(std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > 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();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringMapList___setitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"StringMapList___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<std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > >**)(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<std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > >**)(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<std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,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:
    
    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<std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > >**)(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::asptr(argv[2], (std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >**)(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_StringMapList___setitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_StringMapList___setitem____SWIG_0(self, argc, argv);
    case 3:
      return _wrap_StringMapList___setitem____SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringMapList___setitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::map< std::string,std::string > >::__setitem__(PySliceObject *,std::vector< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > > const &)\n"
    "    std::vector< std::map< std::string,std::string > >::__setitem__(PySliceObject *)\n"
    "    std::vector< std::map< std::string,std::string > >::__setitem__(std::vector< std::map< std::string,std::string > >::difference_type,std::vector< std::map< std::string,std::string > >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_StringMapList_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 0 ;
  std::vector< std::map< std::string,std::string > >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:StringMapList_append",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList_append" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(argp1);
  {
    std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > *ptr = (std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > *)0;
    res2 = swig::asptr(obj1, &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "StringMapList_append" "', argument " "2"" of type '" "std::vector< std::map< std::string,std::string > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringMapList_append" "', argument " "2"" of type '" "std::vector< std::map< std::string,std::string > >::value_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__Sg__append(arg1,(std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,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_new_StringMapList__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *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< std::map< std::string,std::string > > *)new std::vector< std::map< std::string,std::string > >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_StringMapList__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  std::vector< std::map< std::string,std::string > > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  {
    std::vector<std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > > *ptr = (std::vector<std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > > *)0;
    res1 = swig::asptr(swig_obj[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_StringMapList" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_StringMapList" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::map< std::string,std::string > > *)new std::vector< std::map< std::string,std::string > >((std::vector< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > 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_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_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_StringMapList_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 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_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList_empty" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((std::vector< std::map< std::string,std::string > > 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_StringMapList_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::map< std::string,std::string > >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList_size" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< std::map< std::string,std::string > > 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_StringMapList_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 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_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList_clear" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(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_StringMapList_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 0 ;
  std::vector< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > *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:StringMapList_swap",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList_swap" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "StringMapList_swap" "', argument " "2"" of type '" "std::vector< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringMapList_swap" "', argument " "2"" of type '" "std::vector< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > * >(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_StringMapList_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList_get_allocator" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< std::map< std::string,std::string > > 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< std::map< std::string,std::string > >::allocator_type(static_cast< const std::vector< std::map< std::string,std::string > >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringMapList_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::map< std::string,std::string > >::iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList_begin" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(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< std::map< std::string,std::string > >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringMapList_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::map< std::string,std::string > >::iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList_end" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(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< std::map< std::string,std::string > >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringMapList_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::map< std::string,std::string > >::reverse_iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList_rbegin" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(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< std::map< std::string,std::string > >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringMapList_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::map< std::string,std::string > >::reverse_iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList_rend" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(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< std::map< std::string,std::string > >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_StringMapList__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > >::size_type arg1 ;
  size_t val1 ;
  int ecode1 = 0 ;
  std::vector< std::map< std::string,std::string > > *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_StringMapList" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > >::size_type""'");
  } 
  arg1 = static_cast< std::vector< std::map< std::string,std::string > >::size_type >(val1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::map< std::string,std::string > > *)new std::vector< std::map< std::string,std::string > >(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_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringMapList_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 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_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList_pop_back" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(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_StringMapList_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 0 ;
  std::vector< std::map< std::string,std::string > >::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_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList_resize" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringMapList_resize" "', argument " "2"" of type '" "std::vector< std::map< std::string,std::string > >::size_type""'");
  } 
  arg2 = static_cast< std::vector< std::map< std::string,std::string > >::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_StringMapList_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 0 ;
  std::vector< std::map< std::string,std::string > >::iterator arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  std::vector< std::map< std::string,std::string > >::iterator result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList_erase" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(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 '" "StringMapList_erase" "', argument " "2"" of type '" "std::vector< std::map< std::string,std::string > >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::map< std::string,std::string > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::map< std::string,std::string > >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringMapList_erase" "', argument " "2"" of type '" "std::vector< std::map< std::string,std::string > >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__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< std::map< std::string,std::string > >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringMapList_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 0 ;
  std::vector< std::map< std::string,std::string > >::iterator arg2 ;
  std::vector< std::map< std::string,std::string > >::iterator arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  swig::SwigPyIterator *iter3 = 0 ;
  int res3 ;
  std::vector< std::map< std::string,std::string > >::iterator result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList_erase" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(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 '" "StringMapList_erase" "', argument " "2"" of type '" "std::vector< std::map< std::string,std::string > >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::map< std::string,std::string > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::map< std::string,std::string > >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringMapList_erase" "', argument " "2"" of type '" "std::vector< std::map< std::string,std::string > >::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 '" "StringMapList_erase" "', argument " "3"" of type '" "std::vector< std::map< std::string,std::string > >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::map< std::string,std::string > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::map< std::string,std::string > >::iterator > *>(iter3);
    if (iter_t) {
      arg3 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringMapList_erase" "', argument " "3"" of type '" "std::vector< std::map< std::string,std::string > >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__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< std::map< std::string,std::string > >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringMapList_erase(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"StringMapList_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<std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > >**)(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< std::map< std::string,std::string > >::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<std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > >**)(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< std::map< std::string,std::string > >::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< std::map< std::string,std::string > >::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_StringMapList_erase__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_StringMapList_erase__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringMapList_erase'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::map< std::string,std::string > >::erase(std::vector< std::map< std::string,std::string > >::iterator)\n"
    "    std::vector< std::map< std::string,std::string > >::erase(std::vector< std::map< std::string,std::string > >::iterator,std::vector< std::map< std::string,std::string > >::iterator)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_new_StringMapList__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > >::size_type arg1 ;
  std::vector< std::map< std::string,std::string > >::value_type *arg2 = 0 ;
  size_t val1 ;
  int ecode1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  std::vector< std::map< std::string,std::string > > *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_StringMapList" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > >::size_type""'");
  } 
  arg1 = static_cast< std::vector< std::map< std::string,std::string > >::size_type >(val1);
  {
    std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > *ptr = (std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > *)0;
    res2 = swig::asptr(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_StringMapList" "', argument " "2"" of type '" "std::vector< std::map< std::string,std::string > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_StringMapList" "', argument " "2"" of type '" "std::vector< std::map< std::string,std::string > >::value_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::map< std::string,std::string > > *)new std::vector< std::map< std::string,std::string > >(arg1,(std::vector< std::map< std::string,std::string > >::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_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, SWIG_POINTER_NEW |  0 );
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_StringMapList(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_StringMapList",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<std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > >**)(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::asptr(argv[1], (std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >**)(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_StringMapList__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_StringMapList__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_new_StringMapList__SWIG_1(self, argc, argv);
    case 4:
      return _wrap_new_StringMapList__SWIG_3(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_StringMapList'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::map< std::string,std::string > >::vector()\n"
    "    std::vector< std::map< std::string,std::string > >::vector(std::vector< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > const &)\n"
    "    std::vector< std::map< std::string,std::string > >::vector(std::vector< std::map< std::string,std::string > >::size_type)\n"
    "    std::vector< std::map< std::string,std::string > >::vector(std::vector< std::map< std::string,std::string > >::size_type,std::vector< std::map< std::string,std::string > >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_StringMapList_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 0 ;
  std::vector< std::map< std::string,std::string > >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:StringMapList_push_back",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList_push_back" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(argp1);
  {
    std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > *ptr = (std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > *)0;
    res2 = swig::asptr(obj1, &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "StringMapList_push_back" "', argument " "2"" of type '" "std::vector< std::map< std::string,std::string > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringMapList_push_back" "', argument " "2"" of type '" "std::vector< std::map< std::string,std::string > >::value_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->push_back((std::vector< std::map< std::string,std::string > >::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();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringMapList_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::map< std::string,std::string > >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList_front" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::map< std::string,std::string > >::value_type *) &((std::vector< std::map< std::string,std::string > > 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(static_cast< std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringMapList_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::map< std::string,std::string > >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList_back" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::map< std::string,std::string > >::value_type *) &((std::vector< std::map< std::string,std::string > > 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(static_cast< std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringMapList_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 0 ;
  std::vector< std::map< std::string,std::string > >::size_type arg2 ;
  std::vector< std::map< std::string,std::string > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  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:StringMapList_assign",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList_assign" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringMapList_assign" "', argument " "2"" of type '" "std::vector< std::map< std::string,std::string > >::size_type""'");
  } 
  arg2 = static_cast< std::vector< std::map< std::string,std::string > >::size_type >(val2);
  {
    std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > *ptr = (std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > *)0;
    res3 = swig::asptr(obj2, &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringMapList_assign" "', argument " "3"" of type '" "std::vector< std::map< std::string,std::string > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringMapList_assign" "', argument " "3"" of type '" "std::vector< std::map< std::string,std::string > >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->assign(arg2,(std::vector< std::map< std::string,std::string > >::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();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringMapList_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 0 ;
  std::vector< std::map< std::string,std::string > >::size_type arg2 ;
  std::vector< std::map< std::string,std::string > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList_resize" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringMapList_resize" "', argument " "2"" of type '" "std::vector< std::map< std::string,std::string > >::size_type""'");
  } 
  arg2 = static_cast< std::vector< std::map< std::string,std::string > >::size_type >(val2);
  {
    std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > *ptr = (std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringMapList_resize" "', argument " "3"" of type '" "std::vector< std::map< std::string,std::string > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringMapList_resize" "', argument " "3"" of type '" "std::vector< std::map< std::string,std::string > >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resize(arg2,(std::vector< std::map< std::string,std::string > >::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();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringMapList_resize(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"StringMapList_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<std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > >**)(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<std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > >**)(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::asptr(argv[2], (std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,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_StringMapList_resize__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_StringMapList_resize__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringMapList_resize'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::map< std::string,std::string > >::resize(std::vector< std::map< std::string,std::string > >::size_type)\n"
    "    std::vector< std::map< std::string,std::string > >::resize(std::vector< std::map< std::string,std::string > >::size_type,std::vector< std::map< std::string,std::string > >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_StringMapList_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 0 ;
  std::vector< std::map< std::string,std::string > >::iterator arg2 ;
  std::vector< std::map< std::string,std::string > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  int res3 = SWIG_OLDOBJ ;
  std::vector< std::map< std::string,std::string > >::iterator result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList_insert" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(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 '" "StringMapList_insert" "', argument " "2"" of type '" "std::vector< std::map< std::string,std::string > >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::map< std::string,std::string > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::map< std::string,std::string > >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringMapList_insert" "', argument " "2"" of type '" "std::vector< std::map< std::string,std::string > >::iterator""'");
    }
  }
  {
    std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > *ptr = (std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringMapList_insert" "', argument " "3"" of type '" "std::vector< std::map< std::string,std::string > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringMapList_insert" "', argument " "3"" of type '" "std::vector< std::map< std::string,std::string > >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__Sg__insert__SWIG_0(arg1,arg2,(std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > 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< std::map< std::string,std::string > >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_StringMapList_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 0 ;
  std::vector< std::map< std::string,std::string > >::iterator arg2 ;
  std::vector< std::map< std::string,std::string > >::size_type arg3 ;
  std::vector< std::map< std::string,std::string > >::value_type *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  size_t val3 ;
  int ecode3 = 0 ;
  int res4 = SWIG_OLDOBJ ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList_insert" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(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 '" "StringMapList_insert" "', argument " "2"" of type '" "std::vector< std::map< std::string,std::string > >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::map< std::string,std::string > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::map< std::string,std::string > >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringMapList_insert" "', argument " "2"" of type '" "std::vector< std::map< std::string,std::string > >::iterator""'");
    }
  }
  ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringMapList_insert" "', argument " "3"" of type '" "std::vector< std::map< std::string,std::string > >::size_type""'");
  } 
  arg3 = static_cast< std::vector< std::map< std::string,std::string > >::size_type >(val3);
  {
    std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > *ptr = (std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > *)0;
    res4 = swig::asptr(swig_obj[3], &ptr);
    if (!SWIG_IsOK(res4)) {
      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "StringMapList_insert" "', argument " "4"" of type '" "std::vector< std::map< std::string,std::string > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringMapList_insert" "', argument " "4"" of type '" "std::vector< std::map< std::string,std::string > >::value_type const &""'"); 
    }
    arg4 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_vector_Sl_std_map_Sl_std_string_Sc_std_string_Sg__Sg__insert__SWIG_1(arg1,arg2,arg3,(std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > 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_StringMapList_insert(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"StringMapList_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<std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > >**)(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< std::map< std::string,std::string > >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = swig::asptr(argv[2], (std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >**)(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;
      {
        int res = swig::asptr(argv[0], (std::vector<std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > >**)(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< std::map< std::string,std::string > >::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::asptr(argv[3], (std::map<std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,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_StringMapList_insert__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_StringMapList_insert__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringMapList_insert'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::map< std::string,std::string > >::insert(std::vector< std::map< std::string,std::string > >::iterator,std::vector< std::map< std::string,std::string > >::value_type const &)\n"
    "    std::vector< std::map< std::string,std::string > >::insert(std::vector< std::map< std::string,std::string > >::iterator,std::vector< std::map< std::string,std::string > >::size_type,std::vector< std::map< std::string,std::string > >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_StringMapList_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 0 ;
  std::vector< std::map< std::string,std::string > >::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:StringMapList_reserve",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList_reserve" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringMapList_reserve" "', argument " "2"" of type '" "std::vector< std::map< std::string,std::string > >::size_type""'");
  } 
  arg2 = static_cast< std::vector< std::map< std::string,std::string > >::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_StringMapList_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::map< std::string,std::string > >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringMapList_capacity" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< std::map< std::string,std::string > > 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_StringMapList(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::map< std::string,std::string > > *arg1 = (std::vector< std::map< std::string,std::string > > *) 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_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_StringMapList" "', argument " "1"" of type '" "std::vector< std::map< std::string,std::string > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::map< std::string,std::string > > * >(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 *StringMapList_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_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new_StringIntPair__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  std::pair< std::string,NTA_Int32 > *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::pair< std::string,NTA_Int32 > *)new std::pair< std::string,NTA_Int32 >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__pairT_std__string_int_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_StringIntPair__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::string arg1 ;
  int arg2 ;
  int val2 ;
  int ecode2 = 0 ;
  std::pair< std::string,NTA_Int32 > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  {
    std::string *ptr = (std::string *)0;
    int res = SWIG_AsPtr_std_string(swig_obj[0], &ptr);
    if (!SWIG_IsOK(res) || !ptr) {
      SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "new_StringIntPair" "', argument " "1"" of type '" "std::string""'"); 
    }
    arg1 = *ptr;
    if (SWIG_IsNewObj(res)) delete ptr;
  }
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_StringIntPair" "', 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 = (std::pair< std::string,NTA_Int32 > *)new std::pair< std::string,NTA_Int32 >(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_std__pairT_std__string_int_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_StringIntPair__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::pair< std::string,NTA_Int32 > *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  std::pair< std::string,NTA_Int32 > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  {
    std::pair<std::string,int > *ptr = (std::pair<std::string,int > *)0;
    res1 = swig::asptr(swig_obj[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_StringIntPair" "', argument " "1"" of type '" "std::pair< std::string,NTA_Int32 > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_StringIntPair" "', argument " "1"" of type '" "std::pair< std::string,NTA_Int32 > const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::pair< std::string,NTA_Int32 > *)new std::pair< std::string,NTA_Int32 >((std::pair< std::string,NTA_Int32 > 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__pairT_std__string_int_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_new_StringIntPair(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_StringIntPair",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::asptr(argv[0], (std::pair<std::string,int >**)(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_AsPtr_std_string(argv[0], (std::string**)(0));
        _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;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 3;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_3:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_new_StringIntPair__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_StringIntPair__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_new_StringIntPair__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_StringIntPair'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::pair< std::string,NTA_Int32 >::pair()\n"
    "    std::pair< std::string,NTA_Int32 >::pair(std::string,int)\n"
    "    std::pair< std::string,NTA_Int32 >::pair(std::pair< std::string,NTA_Int32 > const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_StringIntPair_first_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::pair< std::string,NTA_Int32 > *arg1 = (std::pair< std::string,NTA_Int32 > *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"StringIntPair_first_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__pairT_std__string_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringIntPair_first_set" "', argument " "1"" of type '" "std::pair< std::string,NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::pair< std::string,NTA_Int32 > * >(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 '" "StringIntPair_first_set" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringIntPair_first_set" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    arg2 = ptr;
  }
  if (arg1) (arg1)->first = *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_StringIntPair_first_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::pair< std::string,NTA_Int32 > *arg1 = (std::pair< std::string,NTA_Int32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::string *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__pairT_std__string_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringIntPair_first_get" "', argument " "1"" of type '" "std::pair< std::string,NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::pair< std::string,NTA_Int32 > * >(argp1);
  result = (std::string *) & ((arg1)->first);
  resultobj = SWIG_From_std_string(static_cast< std::string >(*result));
  return resultobj;
fail:
  return NULL;
}


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


SWIGINTERN PyObject *_wrap_StringIntPair_second_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::pair< std::string,NTA_Int32 > *arg1 = (std::pair< std::string,NTA_Int32 > *) 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_std__pairT_std__string_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringIntPair_second_get" "', argument " "1"" of type '" "std::pair< std::string,NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::pair< std::string,NTA_Int32 > * >(argp1);
  result = (int) ((arg1)->second);
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_StringIntPair(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::pair< std::string,NTA_Int32 > *arg1 = (std::pair< std::string,NTA_Int32 > *) 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__pairT_std__string_int_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_StringIntPair" "', argument " "1"" of type '" "std::pair< std::string,NTA_Int32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::pair< std::string,NTA_Int32 > * >(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 *StringIntPair_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__pairT_std__string_int_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new_PairOfUInt32__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  std::pair< nupic::UInt32,nupic::UInt32 > *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::pair< nupic::UInt32,nupic::UInt32 > *)new std::pair< nupic::UInt32,nupic::UInt32 >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__pairT_unsigned_int_unsigned_int_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_PairOfUInt32__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  unsigned int arg1 ;
  unsigned int arg2 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  std::pair< nupic::UInt32,nupic::UInt32 > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  ecode1 = SWIG_AsVal_unsigned_SS_int(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_PairOfUInt32" "', argument " "1"" of type '" "unsigned int""'");
  } 
  arg1 = static_cast< unsigned int >(val1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_PairOfUInt32" "', argument " "2"" of type '" "unsigned int""'");
  } 
  arg2 = static_cast< unsigned int >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::pair< nupic::UInt32,nupic::UInt32 > *)new std::pair< nupic::UInt32,nupic::UInt32 >(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_std__pairT_unsigned_int_unsigned_int_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_PairOfUInt32__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::pair< nupic::UInt32,nupic::UInt32 > *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  std::pair< nupic::UInt32,nupic::UInt32 > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  {
    std::pair<unsigned int,unsigned int > *ptr = (std::pair<unsigned int,unsigned int > *)0;
    res1 = swig::asptr(swig_obj[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_PairOfUInt32" "', argument " "1"" of type '" "std::pair< nupic::UInt32,nupic::UInt32 > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_PairOfUInt32" "', argument " "1"" of type '" "std::pair< nupic::UInt32,nupic::UInt32 > const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::pair< nupic::UInt32,nupic::UInt32 > *)new std::pair< nupic::UInt32,nupic::UInt32 >((std::pair< nupic::UInt32,nupic::UInt32 > 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__pairT_unsigned_int_unsigned_int_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_new_PairOfUInt32(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_PairOfUInt32",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::asptr(argv[0], (std::pair<unsigned int,unsigned int >**)(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_unsigned_SS_int(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_PairOfUInt32__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_PairOfUInt32__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_new_PairOfUInt32__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_PairOfUInt32'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::pair< nupic::UInt32,nupic::UInt32 >::pair()\n"
    "    std::pair< nupic::UInt32,nupic::UInt32 >::pair(unsigned int,unsigned int)\n"
    "    std::pair< nupic::UInt32,nupic::UInt32 >::pair(std::pair< nupic::UInt32,nupic::UInt32 > const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_PairOfUInt32_first_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::pair< nupic::UInt32,nupic::UInt32 > *arg1 = (std::pair< nupic::UInt32,nupic::UInt32 > *) 0 ;
  unsigned int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"PairOfUInt32_first_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__pairT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PairOfUInt32_first_set" "', argument " "1"" of type '" "std::pair< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::pair< nupic::UInt32,nupic::UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "PairOfUInt32_first_set" "', argument " "2"" of type '" "unsigned int""'");
  } 
  arg2 = static_cast< unsigned int >(val2);
  if (arg1) (arg1)->first = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_PairOfUInt32_first_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::pair< nupic::UInt32,nupic::UInt32 > *arg1 = (std::pair< nupic::UInt32,nupic::UInt32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  unsigned int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__pairT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PairOfUInt32_first_get" "', argument " "1"" of type '" "std::pair< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::pair< nupic::UInt32,nupic::UInt32 > * >(argp1);
  result = (unsigned int) ((arg1)->first);
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_PairOfUInt32_second_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::pair< nupic::UInt32,nupic::UInt32 > *arg1 = (std::pair< nupic::UInt32,nupic::UInt32 > *) 0 ;
  unsigned int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"PairOfUInt32_second_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__pairT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PairOfUInt32_second_set" "', argument " "1"" of type '" "std::pair< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::pair< nupic::UInt32,nupic::UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "PairOfUInt32_second_set" "', argument " "2"" of type '" "unsigned int""'");
  } 
  arg2 = static_cast< unsigned int >(val2);
  if (arg1) (arg1)->second = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_PairOfUInt32_second_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::pair< nupic::UInt32,nupic::UInt32 > *arg1 = (std::pair< nupic::UInt32,nupic::UInt32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  unsigned int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__pairT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PairOfUInt32_second_get" "', argument " "1"" of type '" "std::pair< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::pair< nupic::UInt32,nupic::UInt32 > * >(argp1);
  result = (unsigned int) ((arg1)->second);
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_PairOfUInt32(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::pair< nupic::UInt32,nupic::UInt32 > *arg1 = (std::pair< nupic::UInt32,nupic::UInt32 > *) 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__pairT_unsigned_int_unsigned_int_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_PairOfUInt32" "', argument " "1"" of type '" "std::pair< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::pair< nupic::UInt32,nupic::UInt32 > * >(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 *PairOfUInt32_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__pairT_unsigned_int_unsigned_int_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_VectorOfPairsOfUInt32_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 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_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32_iterator" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (swig::SwigPyIterator *)std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__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_VectorOfPairsOfUInt32___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 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_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32___nonzero__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg____nonzero__((std::vector< std::pair< unsigned int,unsigned int > > 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_VectorOfPairsOfUInt32___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 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_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32___bool__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg____bool__((std::vector< std::pair< unsigned int,unsigned int > > 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_VectorOfPairsOfUInt32___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::pair< unsigned int,unsigned int > >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32___len__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg____len__((std::vector< std::pair< unsigned int,unsigned int > > 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_VectorOfPairsOfUInt32_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::pair< unsigned int,unsigned int > >::value_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32_pop" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__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(static_cast< std::pair<unsigned int,unsigned int > >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsOfUInt32___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 0 ;
  std::vector< std::pair< unsigned int,unsigned int > >::difference_type arg2 ;
  std::vector< std::pair< unsigned int,unsigned int > >::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< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:VectorOfPairsOfUInt32___getslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32___getslice__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfPairsOfUInt32___getslice__" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< unsigned int,unsigned int > >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfPairsOfUInt32___getslice__" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< std::pair< unsigned int,unsigned int > >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > *)std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__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_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsOfUInt32___setslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 0 ;
  std::vector< std::pair< unsigned int,unsigned int > >::difference_type arg2 ;
  std::vector< std::pair< unsigned int,unsigned int > >::difference_type arg3 ;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > const &arg4_defvalue = std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >() ;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg4 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > *) &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:VectorOfPairsOfUInt32___setslice__",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32___setslice__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfPairsOfUInt32___setslice__" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< unsigned int,unsigned int > >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfPairsOfUInt32___setslice__" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< std::pair< unsigned int,unsigned int > >::difference_type >(val3);
  if (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;
      res4 = swig::asptr(obj3, &ptr);
      if (!SWIG_IsOK(res4)) {
        SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "VectorOfPairsOfUInt32___setslice__" "', argument " "4"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > const &""'"); 
      }
      if (!ptr) {
        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfPairsOfUInt32___setslice__" "', argument " "4"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > const &""'"); 
      }
      arg4 = ptr;
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg____setslice__(arg1,arg2,arg3,(std::vector< std::pair< unsigned int,unsigned int >,std::allocator< std::pair< unsigned int,unsigned int > > > 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_VectorOfPairsOfUInt32___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 0 ;
  std::vector< std::pair< unsigned int,unsigned int > >::difference_type arg2 ;
  std::vector< std::pair< unsigned int,unsigned int > >::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:VectorOfPairsOfUInt32___delslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32___delslice__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfPairsOfUInt32___delslice__" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< unsigned int,unsigned int > >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfPairsOfUInt32___delslice__" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< std::pair< unsigned int,unsigned int > >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__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_VectorOfPairsOfUInt32___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 0 ;
  std::vector< std::pair< unsigned int,unsigned int > >::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_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32___delitem__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfPairsOfUInt32___delitem__" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< unsigned int,unsigned int > >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__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_VectorOfPairsOfUInt32___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32___getitem__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfPairsOfUInt32___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< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > *)std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__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_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsOfUInt32___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > *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_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32___setitem__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfPairsOfUInt32___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    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;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VectorOfPairsOfUInt32___setitem__" "', argument " "3"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfPairsOfUInt32___setitem__" "', argument " "3"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg____setitem____SWIG_0(arg1,arg2,(std::vector< std::pair< unsigned int,unsigned int >,std::allocator< std::pair< unsigned int,unsigned int > > > 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_VectorOfPairsOfUInt32___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 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_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32___setitem__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfPairsOfUInt32___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_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__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_VectorOfPairsOfUInt32___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 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_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32___delitem__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfPairsOfUInt32___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_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__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_VectorOfPairsOfUInt32___delitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfPairsOfUInt32___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<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >**)(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<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >**)(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_VectorOfPairsOfUInt32___delitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_VectorOfPairsOfUInt32___delitem____SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfPairsOfUInt32___delitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::UInt32 > >::__delitem__(std::vector< std::pair< unsigned int,unsigned int > >::difference_type)\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::UInt32 > >::__delitem__(PySliceObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsOfUInt32___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 0 ;
  std::vector< std::pair< unsigned int,unsigned int > >::difference_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  std::vector< std::pair< unsigned int,unsigned int > >::value_type *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32___getitem__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfPairsOfUInt32___getitem__" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< unsigned int,unsigned int > >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< std::pair< unsigned int,unsigned int > >::value_type *) &std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg____getitem____SWIG_1((std::vector< std::pair< unsigned int,unsigned int > > 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(static_cast< std::pair<unsigned int,unsigned int > >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsOfUInt32___getitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfPairsOfUInt32___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<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >**)(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<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >**)(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_VectorOfPairsOfUInt32___getitem____SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfPairsOfUInt32___getitem____SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfPairsOfUInt32___getitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::UInt32 > >::__getitem__(PySliceObject *)\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::UInt32 > >::__getitem__(std::vector< std::pair< unsigned int,unsigned int > >::difference_type) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsOfUInt32___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 0 ;
  std::vector< std::pair< unsigned int,unsigned int > >::difference_type arg2 ;
  std::vector< std::pair< unsigned int,unsigned int > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32___setitem__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfPairsOfUInt32___setitem__" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< unsigned int,unsigned int > >::difference_type >(val2);
  {
    std::pair<unsigned int,unsigned int > *ptr = (std::pair<unsigned int,unsigned int > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VectorOfPairsOfUInt32___setitem__" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfPairsOfUInt32___setitem__" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg____setitem____SWIG_2(arg1,arg2,(std::pair< unsigned int,unsigned int > 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();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsOfUInt32___setitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfPairsOfUInt32___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<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >**)(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<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >**)(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<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >**)(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<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >**)(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::asptr(argv[2], (std::pair<unsigned int,unsigned int >**)(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_VectorOfPairsOfUInt32___setitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_VectorOfPairsOfUInt32___setitem____SWIG_0(self, argc, argv);
    case 3:
      return _wrap_VectorOfPairsOfUInt32___setitem____SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfPairsOfUInt32___setitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::UInt32 > >::__setitem__(PySliceObject *,std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > const &)\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::UInt32 > >::__setitem__(PySliceObject *)\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::UInt32 > >::__setitem__(std::vector< std::pair< unsigned int,unsigned int > >::difference_type,std::vector< std::pair< unsigned int,unsigned int > >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsOfUInt32_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 0 ;
  std::vector< std::pair< unsigned int,unsigned int > >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:VectorOfPairsOfUInt32_append",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32_append" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(argp1);
  {
    std::pair<unsigned int,unsigned int > *ptr = (std::pair<unsigned int,unsigned int > *)0;
    res2 = swig::asptr(obj1, &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VectorOfPairsOfUInt32_append" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfPairsOfUInt32_append" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::value_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__append(arg1,(std::pair< unsigned int,unsigned int > 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_new_VectorOfPairsOfUInt32__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *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< std::pair< nupic::UInt32,nupic::UInt32 > > *)new std::vector< std::pair< nupic::UInt32,nupic::UInt32 > >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_VectorOfPairsOfUInt32__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  {
    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;
    res1 = swig::asptr(swig_obj[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_VectorOfPairsOfUInt32" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VectorOfPairsOfUInt32" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *)new std::vector< std::pair< nupic::UInt32,nupic::UInt32 > >((std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > 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_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_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_VectorOfPairsOfUInt32_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 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_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32_empty" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > 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_VectorOfPairsOfUInt32_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::pair< unsigned int,unsigned int > >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32_size" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > 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_VectorOfPairsOfUInt32_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 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_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32_clear" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(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_VectorOfPairsOfUInt32_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 0 ;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *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:VectorOfPairsOfUInt32_swap",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32_swap" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VectorOfPairsOfUInt32_swap" "', argument " "2"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfPairsOfUInt32_swap" "', argument " "2"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(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_VectorOfPairsOfUInt32_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::allocator< std::pair< unsigned int,unsigned int > > > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32_get_allocator" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > 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< std::pair< unsigned int,unsigned int > >::allocator_type(static_cast< const std::vector< std::pair< unsigned int,unsigned int > >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsOfUInt32_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,unsigned int > >::iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32_begin" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(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< std::pair< unsigned int,unsigned int > >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsOfUInt32_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,unsigned int > >::iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32_end" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(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< std::pair< unsigned int,unsigned int > >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsOfUInt32_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,unsigned int > >::reverse_iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32_rbegin" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(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< std::pair< unsigned int,unsigned int > >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsOfUInt32_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,unsigned int > >::reverse_iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32_rend" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(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< std::pair< unsigned int,unsigned int > >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_VectorOfPairsOfUInt32__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< unsigned int,unsigned int > >::size_type arg1 ;
  size_t val1 ;
  int ecode1 = 0 ;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *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_VectorOfPairsOfUInt32" "', argument " "1"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::size_type""'");
  } 
  arg1 = static_cast< std::vector< std::pair< unsigned int,unsigned int > >::size_type >(val1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *)new std::vector< std::pair< nupic::UInt32,nupic::UInt32 > >(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_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsOfUInt32_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 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_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32_pop_back" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(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_VectorOfPairsOfUInt32_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 0 ;
  std::vector< std::pair< unsigned int,unsigned int > >::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_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32_resize" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfPairsOfUInt32_resize" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::size_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< unsigned int,unsigned int > >::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_VectorOfPairsOfUInt32_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 0 ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,unsigned int > >::iterator > arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,unsigned int > >::iterator > result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32_erase" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(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 '" "VectorOfPairsOfUInt32_erase" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::pair< unsigned int,unsigned int > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::pair< unsigned int,unsigned int > >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfPairsOfUInt32_erase" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__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< std::pair< unsigned int,unsigned int > >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsOfUInt32_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 0 ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,unsigned int > >::iterator > arg2 ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,unsigned int > >::iterator > arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  swig::SwigPyIterator *iter3 = 0 ;
  int res3 ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,unsigned int > >::iterator > result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32_erase" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(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 '" "VectorOfPairsOfUInt32_erase" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::pair< unsigned int,unsigned int > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::pair< unsigned int,unsigned int > >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfPairsOfUInt32_erase" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::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 '" "VectorOfPairsOfUInt32_erase" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::pair< unsigned int,unsigned int > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::pair< unsigned int,unsigned int > >::iterator > *>(iter3);
    if (iter_t) {
      arg3 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfPairsOfUInt32_erase" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__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< std::pair< unsigned int,unsigned int > >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsOfUInt32_erase(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfPairsOfUInt32_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<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >**)(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< std::pair< unsigned int,unsigned int > >::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<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >**)(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< std::pair< unsigned int,unsigned int > >::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< std::pair< unsigned int,unsigned int > >::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_VectorOfPairsOfUInt32_erase__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfPairsOfUInt32_erase__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfPairsOfUInt32_erase'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::UInt32 > >::erase(std::vector< std::pair< unsigned int,unsigned int > >::iterator)\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::UInt32 > >::erase(std::vector< std::pair< unsigned int,unsigned int > >::iterator,std::vector< std::pair< unsigned int,unsigned int > >::iterator)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_new_VectorOfPairsOfUInt32__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< unsigned int,unsigned int > >::size_type arg1 ;
  std::vector< std::pair< unsigned int,unsigned int > >::value_type *arg2 = 0 ;
  size_t val1 ;
  int ecode1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *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_VectorOfPairsOfUInt32" "', argument " "1"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::size_type""'");
  } 
  arg1 = static_cast< std::vector< std::pair< unsigned int,unsigned int > >::size_type >(val1);
  {
    std::pair<unsigned int,unsigned int > *ptr = (std::pair<unsigned int,unsigned int > *)0;
    res2 = swig::asptr(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_VectorOfPairsOfUInt32" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VectorOfPairsOfUInt32" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::value_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *)new std::vector< std::pair< nupic::UInt32,nupic::UInt32 > >(arg1,(std::vector< std::pair< unsigned int,unsigned int > >::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_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, SWIG_POINTER_NEW |  0 );
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_VectorOfPairsOfUInt32(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_VectorOfPairsOfUInt32",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<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >**)(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::asptr(argv[1], (std::pair<unsigned int,unsigned int >**)(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_VectorOfPairsOfUInt32__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_VectorOfPairsOfUInt32__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_new_VectorOfPairsOfUInt32__SWIG_1(self, argc, argv);
    case 4:
      return _wrap_new_VectorOfPairsOfUInt32__SWIG_3(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_VectorOfPairsOfUInt32'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::UInt32 > >::vector()\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::UInt32 > >::vector(std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > const &)\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::UInt32 > >::vector(std::vector< std::pair< unsigned int,unsigned int > >::size_type)\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::UInt32 > >::vector(std::vector< std::pair< unsigned int,unsigned int > >::size_type,std::vector< std::pair< unsigned int,unsigned int > >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsOfUInt32_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 0 ;
  std::vector< std::pair< unsigned int,unsigned int > >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:VectorOfPairsOfUInt32_push_back",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32_push_back" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(argp1);
  {
    std::pair<unsigned int,unsigned int > *ptr = (std::pair<unsigned int,unsigned int > *)0;
    res2 = swig::asptr(obj1, &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VectorOfPairsOfUInt32_push_back" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfPairsOfUInt32_push_back" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::value_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->push_back((std::vector< std::pair< unsigned int,unsigned int > >::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();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsOfUInt32_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::pair< unsigned int,unsigned int > >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32_front" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::pair< unsigned int,unsigned int > >::value_type *) &((std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > 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(static_cast< std::pair<unsigned int,unsigned int > >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsOfUInt32_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::pair< unsigned int,unsigned int > >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32_back" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::pair< unsigned int,unsigned int > >::value_type *) &((std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > 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(static_cast< std::pair<unsigned int,unsigned int > >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsOfUInt32_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 0 ;
  std::vector< std::pair< unsigned int,unsigned int > >::size_type arg2 ;
  std::vector< std::pair< unsigned int,unsigned int > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  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:VectorOfPairsOfUInt32_assign",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32_assign" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfPairsOfUInt32_assign" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::size_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< unsigned int,unsigned int > >::size_type >(val2);
  {
    std::pair<unsigned int,unsigned int > *ptr = (std::pair<unsigned int,unsigned int > *)0;
    res3 = swig::asptr(obj2, &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VectorOfPairsOfUInt32_assign" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfPairsOfUInt32_assign" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->assign(arg2,(std::vector< std::pair< unsigned int,unsigned int > >::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();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsOfUInt32_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 0 ;
  std::vector< std::pair< unsigned int,unsigned int > >::size_type arg2 ;
  std::vector< std::pair< unsigned int,unsigned int > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32_resize" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfPairsOfUInt32_resize" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::size_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< unsigned int,unsigned int > >::size_type >(val2);
  {
    std::pair<unsigned int,unsigned int > *ptr = (std::pair<unsigned int,unsigned int > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VectorOfPairsOfUInt32_resize" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfPairsOfUInt32_resize" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resize(arg2,(std::vector< std::pair< unsigned int,unsigned int > >::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();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsOfUInt32_resize(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfPairsOfUInt32_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<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >**)(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<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >**)(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::asptr(argv[2], (std::pair<unsigned int,unsigned int >**)(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_VectorOfPairsOfUInt32_resize__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfPairsOfUInt32_resize__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfPairsOfUInt32_resize'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::UInt32 > >::resize(std::vector< std::pair< unsigned int,unsigned int > >::size_type)\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::UInt32 > >::resize(std::vector< std::pair< unsigned int,unsigned int > >::size_type,std::vector< std::pair< unsigned int,unsigned int > >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsOfUInt32_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 0 ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,unsigned int > >::iterator > arg2 ;
  std::vector< std::pair< unsigned int,unsigned int > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  int res3 = SWIG_OLDOBJ ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,unsigned int > >::iterator > result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32_insert" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(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 '" "VectorOfPairsOfUInt32_insert" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::pair< unsigned int,unsigned int > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::pair< unsigned int,unsigned int > >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfPairsOfUInt32_insert" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::iterator""'");
    }
  }
  {
    std::pair<unsigned int,unsigned int > *ptr = (std::pair<unsigned int,unsigned int > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VectorOfPairsOfUInt32_insert" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfPairsOfUInt32_insert" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__insert__SWIG_0(arg1,arg2,(std::pair< unsigned int,unsigned int > 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< std::pair< unsigned int,unsigned int > >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsOfUInt32_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 0 ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,unsigned int > >::iterator > arg2 ;
  std::vector< std::pair< unsigned int,unsigned int > >::size_type arg3 ;
  std::vector< std::pair< unsigned int,unsigned int > >::value_type *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  size_t val3 ;
  int ecode3 = 0 ;
  int res4 = SWIG_OLDOBJ ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32_insert" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(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 '" "VectorOfPairsOfUInt32_insert" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::pair< unsigned int,unsigned int > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::pair< unsigned int,unsigned int > >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfPairsOfUInt32_insert" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::iterator""'");
    }
  }
  ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfPairsOfUInt32_insert" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::size_type""'");
  } 
  arg3 = static_cast< std::vector< std::pair< unsigned int,unsigned int > >::size_type >(val3);
  {
    std::pair<unsigned int,unsigned int > *ptr = (std::pair<unsigned int,unsigned int > *)0;
    res4 = swig::asptr(swig_obj[3], &ptr);
    if (!SWIG_IsOK(res4)) {
      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "VectorOfPairsOfUInt32_insert" "', argument " "4"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfPairsOfUInt32_insert" "', argument " "4"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::value_type const &""'"); 
    }
    arg4 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__insert__SWIG_1(arg1,arg2,arg3,(std::pair< unsigned int,unsigned int > 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_VectorOfPairsOfUInt32_insert(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfPairsOfUInt32_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<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >**)(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< std::pair< unsigned int,unsigned int > >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = swig::asptr(argv[2], (std::pair<unsigned int,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;
      {
        int res = swig::asptr(argv[0], (std::vector<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >**)(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< std::pair< unsigned int,unsigned int > >::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::asptr(argv[3], (std::pair<unsigned int,unsigned int >**)(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_VectorOfPairsOfUInt32_insert__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfPairsOfUInt32_insert__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfPairsOfUInt32_insert'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::UInt32 > >::insert(std::vector< std::pair< unsigned int,unsigned int > >::iterator,std::vector< std::pair< unsigned int,unsigned int > >::value_type const &)\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::UInt32 > >::insert(std::vector< std::pair< unsigned int,unsigned int > >::iterator,std::vector< std::pair< unsigned int,unsigned int > >::size_type,std::vector< std::pair< unsigned int,unsigned int > >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsOfUInt32_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 0 ;
  std::vector< std::pair< unsigned int,unsigned int > >::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:VectorOfPairsOfUInt32_reserve",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32_reserve" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfPairsOfUInt32_reserve" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,unsigned int > >::size_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< unsigned int,unsigned int > >::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_VectorOfPairsOfUInt32_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::pair< unsigned int,unsigned int > >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsOfUInt32_capacity" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > 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_VectorOfPairsOfUInt32(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *) 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_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_VectorOfPairsOfUInt32" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > * >(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 *VectorOfPairsOfUInt32_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_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_VectorOfVectorsOfPairsOfUInt32_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 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_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32_iterator" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (swig::SwigPyIterator *)std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__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_VectorOfVectorsOfPairsOfUInt32___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 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_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32___nonzero__" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__Sg____nonzero__((std::vector< std::vector< std::pair< unsigned int,unsigned int > > > 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_VectorOfVectorsOfPairsOfUInt32___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 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_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32___bool__" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__Sg____bool__((std::vector< std::vector< std::pair< unsigned int,unsigned int > > > 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_VectorOfVectorsOfPairsOfUInt32___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32___len__" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__Sg____len__((std::vector< std::vector< std::pair< unsigned int,unsigned int > > > 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_VectorOfVectorsOfPairsOfUInt32_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32_pop" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__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(static_cast< std::vector<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfVectorsOfPairsOfUInt32___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 0 ;
  std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type arg2 ;
  std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::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< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > > *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:VectorOfVectorsOfPairsOfUInt32___getslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32___getslice__" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfVectorsOfPairsOfUInt32___getslice__" "', argument " "2"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfVectorsOfPairsOfUInt32___getslice__" "', argument " "3"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > > *)std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__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_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfVectorsOfPairsOfUInt32___setslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 0 ;
  std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type arg2 ;
  std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type arg3 ;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > > const &arg4_defvalue = std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > >() ;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > > *arg4 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > > *) &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:VectorOfVectorsOfPairsOfUInt32___setslice__",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32___setslice__" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfVectorsOfPairsOfUInt32___setslice__" "', argument " "2"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfVectorsOfPairsOfUInt32___setslice__" "', argument " "3"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type >(val3);
  if (obj3) {
    {
      std::vector<std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > > *ptr = (std::vector<std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > > *)0;
      res4 = swig::asptr(obj3, &ptr);
      if (!SWIG_IsOK(res4)) {
        SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "VectorOfVectorsOfPairsOfUInt32___setslice__" "', argument " "4"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > > const &""'"); 
      }
      if (!ptr) {
        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfVectorsOfPairsOfUInt32___setslice__" "', argument " "4"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > > const &""'"); 
      }
      arg4 = ptr;
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__Sg____setslice__(arg1,arg2,arg3,(std::vector< std::vector< std::pair< unsigned int,unsigned int >,std::allocator< std::pair< unsigned int,unsigned int > > >,std::allocator< std::vector< std::pair< unsigned int,unsigned int >,std::allocator< std::pair< unsigned int,unsigned int > > > > > 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_VectorOfVectorsOfPairsOfUInt32___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 0 ;
  std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type arg2 ;
  std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::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:VectorOfVectorsOfPairsOfUInt32___delslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32___delslice__" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfVectorsOfPairsOfUInt32___delslice__" "', argument " "2"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfVectorsOfPairsOfUInt32___delslice__" "', argument " "3"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__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_VectorOfVectorsOfPairsOfUInt32___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 0 ;
  std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::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_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32___delitem__" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfVectorsOfPairsOfUInt32___delitem__" "', argument " "2"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__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_VectorOfVectorsOfPairsOfUInt32___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32___getitem__" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfVectorsOfPairsOfUInt32___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< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > > *)std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__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_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfVectorsOfPairsOfUInt32___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > > *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_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32___setitem__" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfVectorsOfPairsOfUInt32___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    std::vector<std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > > *ptr = (std::vector<std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VectorOfVectorsOfPairsOfUInt32___setitem__" "', argument " "3"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfVectorsOfPairsOfUInt32___setitem__" "', argument " "3"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > > const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__Sg____setitem____SWIG_0(arg1,arg2,(std::vector< std::vector< std::pair< unsigned int,unsigned int >,std::allocator< std::pair< unsigned int,unsigned int > > >,std::allocator< std::vector< std::pair< unsigned int,unsigned int >,std::allocator< std::pair< unsigned int,unsigned int > > > > > 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_VectorOfVectorsOfPairsOfUInt32___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 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_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32___setitem__" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfVectorsOfPairsOfUInt32___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_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__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_VectorOfVectorsOfPairsOfUInt32___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 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_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32___delitem__" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfVectorsOfPairsOfUInt32___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_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__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_VectorOfVectorsOfPairsOfUInt32___delitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfVectorsOfPairsOfUInt32___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<std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > >**)(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<std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > >**)(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_VectorOfVectorsOfPairsOfUInt32___delitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_VectorOfVectorsOfPairsOfUInt32___delitem____SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfVectorsOfPairsOfUInt32___delitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > >::__delitem__(std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type)\n"
    "    std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > >::__delitem__(PySliceObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfVectorsOfPairsOfUInt32___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 0 ;
  std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32___getitem__" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfVectorsOfPairsOfUInt32___getitem__" "', argument " "2"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type *) &std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__Sg____getitem____SWIG_1((std::vector< std::vector< std::pair< unsigned int,unsigned int > > > 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(static_cast< std::vector<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfVectorsOfPairsOfUInt32___getitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfVectorsOfPairsOfUInt32___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<std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > >**)(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<std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > >**)(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_VectorOfVectorsOfPairsOfUInt32___getitem____SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfVectorsOfPairsOfUInt32___getitem____SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfVectorsOfPairsOfUInt32___getitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > >::__getitem__(PySliceObject *)\n"
    "    std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > >::__getitem__(std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfVectorsOfPairsOfUInt32___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 0 ;
  std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type arg2 ;
  std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32___setitem__" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfVectorsOfPairsOfUInt32___setitem__" "', argument " "2"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type >(val2);
  {
    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;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VectorOfVectorsOfPairsOfUInt32___setitem__" "', argument " "3"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfVectorsOfPairsOfUInt32___setitem__" "', argument " "3"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__Sg____setitem____SWIG_2(arg1,arg2,(std::vector< std::pair< unsigned int,unsigned int >,std::allocator< std::pair< unsigned int,unsigned int > > > 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();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfVectorsOfPairsOfUInt32___setitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfVectorsOfPairsOfUInt32___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<std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > >**)(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<std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > >**)(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<std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > >**)(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<std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > >**)(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::asptr(argv[2], (std::vector<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >**)(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_VectorOfVectorsOfPairsOfUInt32___setitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_VectorOfVectorsOfPairsOfUInt32___setitem____SWIG_0(self, argc, argv);
    case 3:
      return _wrap_VectorOfVectorsOfPairsOfUInt32___setitem____SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfVectorsOfPairsOfUInt32___setitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > >::__setitem__(PySliceObject *,std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > > const &)\n"
    "    std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > >::__setitem__(PySliceObject *)\n"
    "    std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > >::__setitem__(std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::difference_type,std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfVectorsOfPairsOfUInt32_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 0 ;
  std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:VectorOfVectorsOfPairsOfUInt32_append",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32_append" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(argp1);
  {
    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;
    res2 = swig::asptr(obj1, &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VectorOfVectorsOfPairsOfUInt32_append" "', argument " "2"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfVectorsOfPairsOfUInt32_append" "', argument " "2"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__Sg__append(arg1,(std::vector< std::pair< unsigned int,unsigned int >,std::allocator< std::pair< unsigned int,unsigned int > > > 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_new_VectorOfVectorsOfPairsOfUInt32__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *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< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *)new std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_VectorOfVectorsOfPairsOfUInt32__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  {
    std::vector<std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > > *ptr = (std::vector<std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > > *)0;
    res1 = swig::asptr(swig_obj[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_VectorOfVectorsOfPairsOfUInt32" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VectorOfVectorsOfPairsOfUInt32" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *)new std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > >((std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > 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_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_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_VectorOfVectorsOfPairsOfUInt32_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 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_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32_empty" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > 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_VectorOfVectorsOfPairsOfUInt32_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32_size" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > 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_VectorOfVectorsOfPairsOfUInt32_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 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_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32_clear" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(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_VectorOfVectorsOfPairsOfUInt32_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 0 ;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > *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:VectorOfVectorsOfPairsOfUInt32_swap",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32_swap" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VectorOfVectorsOfPairsOfUInt32_swap" "', argument " "2"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfVectorsOfPairsOfUInt32_swap" "', argument " "2"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > * >(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_VectorOfVectorsOfPairsOfUInt32_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::allocator< std::vector< std::pair< unsigned int,unsigned int >,std::allocator< std::pair< unsigned int,unsigned int > > > > > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32_get_allocator" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > 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< std::vector< std::pair< unsigned int,unsigned int > > >::allocator_type(static_cast< const std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfVectorsOfPairsOfUInt32_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32_begin" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(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< std::vector< std::pair< unsigned int,unsigned int > > >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfVectorsOfPairsOfUInt32_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32_end" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(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< std::vector< std::pair< unsigned int,unsigned int > > >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfVectorsOfPairsOfUInt32_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::reverse_iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32_rbegin" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(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< std::vector< std::pair< unsigned int,unsigned int > > >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfVectorsOfPairsOfUInt32_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::reverse_iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32_rend" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(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< std::vector< std::pair< unsigned int,unsigned int > > >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_VectorOfVectorsOfPairsOfUInt32__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type arg1 ;
  size_t val1 ;
  int ecode1 = 0 ;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *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_VectorOfVectorsOfPairsOfUInt32" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type""'");
  } 
  arg1 = static_cast< std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type >(val1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *)new std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > >(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_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfVectorsOfPairsOfUInt32_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 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_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32_pop_back" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(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_VectorOfVectorsOfPairsOfUInt32_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 0 ;
  std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::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_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32_resize" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfVectorsOfPairsOfUInt32_resize" "', argument " "2"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type""'");
  } 
  arg2 = static_cast< std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::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_VectorOfVectorsOfPairsOfUInt32_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 0 ;
  SwigValueWrapper< std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator > arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  SwigValueWrapper< std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator > result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32_erase" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(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 '" "VectorOfVectorsOfPairsOfUInt32_erase" "', argument " "2"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfVectorsOfPairsOfUInt32_erase" "', argument " "2"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__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< std::vector< std::pair< unsigned int,unsigned int > > >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfVectorsOfPairsOfUInt32_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 0 ;
  SwigValueWrapper< std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator > arg2 ;
  SwigValueWrapper< std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator > arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  swig::SwigPyIterator *iter3 = 0 ;
  int res3 ;
  SwigValueWrapper< std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator > result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32_erase" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(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 '" "VectorOfVectorsOfPairsOfUInt32_erase" "', argument " "2"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfVectorsOfPairsOfUInt32_erase" "', argument " "2"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::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 '" "VectorOfVectorsOfPairsOfUInt32_erase" "', argument " "3"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator > *>(iter3);
    if (iter_t) {
      arg3 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfVectorsOfPairsOfUInt32_erase" "', argument " "3"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__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< std::vector< std::pair< unsigned int,unsigned int > > >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfVectorsOfPairsOfUInt32_erase(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfVectorsOfPairsOfUInt32_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<std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > >**)(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< std::vector< std::pair< unsigned int,unsigned int > > >::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<std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > >**)(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< std::vector< std::pair< unsigned int,unsigned int > > >::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< std::vector< std::pair< unsigned int,unsigned int > > >::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_VectorOfVectorsOfPairsOfUInt32_erase__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfVectorsOfPairsOfUInt32_erase__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfVectorsOfPairsOfUInt32_erase'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > >::erase(std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator)\n"
    "    std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > >::erase(std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator,std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_new_VectorOfVectorsOfPairsOfUInt32__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type arg1 ;
  std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type *arg2 = 0 ;
  size_t val1 ;
  int ecode1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *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_VectorOfVectorsOfPairsOfUInt32" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type""'");
  } 
  arg1 = static_cast< std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type >(val1);
  {
    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;
    res2 = swig::asptr(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_VectorOfVectorsOfPairsOfUInt32" "', argument " "2"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VectorOfVectorsOfPairsOfUInt32" "', argument " "2"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *)new std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > >(arg1,(std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::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_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, SWIG_POINTER_NEW |  0 );
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_VectorOfVectorsOfPairsOfUInt32(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_VectorOfVectorsOfPairsOfUInt32",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<std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > >**)(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::asptr(argv[1], (std::vector<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >**)(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_VectorOfVectorsOfPairsOfUInt32__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_VectorOfVectorsOfPairsOfUInt32__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_new_VectorOfVectorsOfPairsOfUInt32__SWIG_1(self, argc, argv);
    case 4:
      return _wrap_new_VectorOfVectorsOfPairsOfUInt32__SWIG_3(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_VectorOfVectorsOfPairsOfUInt32'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > >::vector()\n"
    "    std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > >::vector(std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > const &)\n"
    "    std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > >::vector(std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type)\n"
    "    std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > >::vector(std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type,std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfVectorsOfPairsOfUInt32_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 0 ;
  std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:VectorOfVectorsOfPairsOfUInt32_push_back",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32_push_back" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(argp1);
  {
    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;
    res2 = swig::asptr(obj1, &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VectorOfVectorsOfPairsOfUInt32_push_back" "', argument " "2"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfVectorsOfPairsOfUInt32_push_back" "', argument " "2"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->push_back((std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::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();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfVectorsOfPairsOfUInt32_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32_front" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type *) &((std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > 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(static_cast< std::vector<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfVectorsOfPairsOfUInt32_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32_back" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type *) &((std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > 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(static_cast< std::vector<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfVectorsOfPairsOfUInt32_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 0 ;
  std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type arg2 ;
  std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  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:VectorOfVectorsOfPairsOfUInt32_assign",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32_assign" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfVectorsOfPairsOfUInt32_assign" "', argument " "2"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type""'");
  } 
  arg2 = static_cast< std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type >(val2);
  {
    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;
    res3 = swig::asptr(obj2, &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VectorOfVectorsOfPairsOfUInt32_assign" "', argument " "3"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfVectorsOfPairsOfUInt32_assign" "', argument " "3"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->assign(arg2,(std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::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();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfVectorsOfPairsOfUInt32_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 0 ;
  std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type arg2 ;
  std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32_resize" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfVectorsOfPairsOfUInt32_resize" "', argument " "2"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type""'");
  } 
  arg2 = static_cast< std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type >(val2);
  {
    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;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VectorOfVectorsOfPairsOfUInt32_resize" "', argument " "3"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfVectorsOfPairsOfUInt32_resize" "', argument " "3"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resize(arg2,(std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::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();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfVectorsOfPairsOfUInt32_resize(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfVectorsOfPairsOfUInt32_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<std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > >**)(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<std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > >**)(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::asptr(argv[2], (std::vector<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >**)(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_VectorOfVectorsOfPairsOfUInt32_resize__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfVectorsOfPairsOfUInt32_resize__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfVectorsOfPairsOfUInt32_resize'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > >::resize(std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type)\n"
    "    std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > >::resize(std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type,std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfVectorsOfPairsOfUInt32_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 0 ;
  SwigValueWrapper< std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator > arg2 ;
  std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  int res3 = SWIG_OLDOBJ ;
  SwigValueWrapper< std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator > result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32_insert" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(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 '" "VectorOfVectorsOfPairsOfUInt32_insert" "', argument " "2"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfVectorsOfPairsOfUInt32_insert" "', argument " "2"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator""'");
    }
  }
  {
    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;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VectorOfVectorsOfPairsOfUInt32_insert" "', argument " "3"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfVectorsOfPairsOfUInt32_insert" "', argument " "3"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__Sg__insert__SWIG_0(arg1,arg2,(std::vector< std::pair< unsigned int,unsigned int >,std::allocator< std::pair< unsigned int,unsigned int > > > 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< std::vector< std::pair< unsigned int,unsigned int > > >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfVectorsOfPairsOfUInt32_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 0 ;
  SwigValueWrapper< std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator > arg2 ;
  std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type arg3 ;
  std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  size_t val3 ;
  int ecode3 = 0 ;
  int res4 = SWIG_OLDOBJ ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32_insert" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(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 '" "VectorOfVectorsOfPairsOfUInt32_insert" "', argument " "2"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfVectorsOfPairsOfUInt32_insert" "', argument " "2"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator""'");
    }
  }
  ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfVectorsOfPairsOfUInt32_insert" "', argument " "3"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type""'");
  } 
  arg3 = static_cast< std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type >(val3);
  {
    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;
    res4 = swig::asptr(swig_obj[3], &ptr);
    if (!SWIG_IsOK(res4)) {
      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "VectorOfVectorsOfPairsOfUInt32_insert" "', argument " "4"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfVectorsOfPairsOfUInt32_insert" "', argument " "4"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type const &""'"); 
    }
    arg4 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_vector_Sl_std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__Sg__Sg__insert__SWIG_1(arg1,arg2,arg3,(std::vector< std::pair< unsigned int,unsigned int >,std::allocator< std::pair< unsigned int,unsigned int > > > 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_VectorOfVectorsOfPairsOfUInt32_insert(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfVectorsOfPairsOfUInt32_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<std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > >**)(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< std::vector< std::pair< unsigned int,unsigned int > > >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = swig::asptr(argv[2], (std::vector<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >**)(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;
      {
        int res = swig::asptr(argv[0], (std::vector<std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > >**)(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< std::vector< std::pair< unsigned int,unsigned int > > >::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::asptr(argv[3], (std::vector<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >**)(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_VectorOfVectorsOfPairsOfUInt32_insert__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfVectorsOfPairsOfUInt32_insert__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfVectorsOfPairsOfUInt32_insert'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > >::insert(std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator,std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type const &)\n"
    "    std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > >::insert(std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator,std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type,std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfVectorsOfPairsOfUInt32_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 0 ;
  std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::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:VectorOfVectorsOfPairsOfUInt32_reserve",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32_reserve" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfVectorsOfPairsOfUInt32_reserve" "', argument " "2"" of type '" "std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type""'");
  } 
  arg2 = static_cast< std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::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_VectorOfVectorsOfPairsOfUInt32_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfVectorsOfPairsOfUInt32_capacity" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > 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_VectorOfVectorsOfPairsOfUInt32(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *arg1 = (std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *) 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_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_VectorOfVectorsOfPairsOfUInt32" "', argument " "1"" of type '" "std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > * >(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 *VectorOfVectorsOfPairsOfUInt32_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_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new_PairUInt32Real32__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  std::pair< nupic::UInt32,nupic::Real32 > *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::pair< nupic::UInt32,nupic::Real32 > *)new std::pair< nupic::UInt32,nupic::Real32 >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__pairT_unsigned_int_float_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_PairUInt32Real32__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  unsigned int arg1 ;
  float arg2 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  float val2 ;
  int ecode2 = 0 ;
  std::pair< nupic::UInt32,nupic::Real32 > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  ecode1 = SWIG_AsVal_unsigned_SS_int(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_PairUInt32Real32" "', argument " "1"" of type '" "unsigned int""'");
  } 
  arg1 = static_cast< unsigned int >(val1);
  ecode2 = SWIG_AsVal_float(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_PairUInt32Real32" "', argument " "2"" of type '" "float""'");
  } 
  arg2 = static_cast< float >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::pair< nupic::UInt32,nupic::Real32 > *)new std::pair< nupic::UInt32,nupic::Real32 >(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_std__pairT_unsigned_int_float_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_PairUInt32Real32__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::pair< nupic::UInt32,nupic::Real32 > *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  std::pair< nupic::UInt32,nupic::Real32 > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  {
    std::pair<unsigned int,float > *ptr = (std::pair<unsigned int,float > *)0;
    res1 = swig::asptr(swig_obj[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_PairUInt32Real32" "', argument " "1"" of type '" "std::pair< nupic::UInt32,nupic::Real32 > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_PairUInt32Real32" "', argument " "1"" of type '" "std::pair< nupic::UInt32,nupic::Real32 > const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::pair< nupic::UInt32,nupic::Real32 > *)new std::pair< nupic::UInt32,nupic::Real32 >((std::pair< nupic::UInt32,nupic::Real32 > 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__pairT_unsigned_int_float_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_new_PairUInt32Real32(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_PairUInt32Real32",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::asptr(argv[0], (std::pair<unsigned int,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:
    
    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_PairUInt32Real32__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_PairUInt32Real32__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_new_PairUInt32Real32__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_PairUInt32Real32'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::pair< nupic::UInt32,nupic::Real32 >::pair()\n"
    "    std::pair< nupic::UInt32,nupic::Real32 >::pair(unsigned int,float)\n"
    "    std::pair< nupic::UInt32,nupic::Real32 >::pair(std::pair< nupic::UInt32,nupic::Real32 > const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_PairUInt32Real32_first_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::pair< nupic::UInt32,nupic::Real32 > *arg1 = (std::pair< nupic::UInt32,nupic::Real32 > *) 0 ;
  unsigned int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"PairUInt32Real32_first_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__pairT_unsigned_int_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PairUInt32Real32_first_set" "', argument " "1"" of type '" "std::pair< nupic::UInt32,nupic::Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::pair< nupic::UInt32,nupic::Real32 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "PairUInt32Real32_first_set" "', argument " "2"" of type '" "unsigned int""'");
  } 
  arg2 = static_cast< unsigned int >(val2);
  if (arg1) (arg1)->first = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_PairUInt32Real32_first_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::pair< nupic::UInt32,nupic::Real32 > *arg1 = (std::pair< nupic::UInt32,nupic::Real32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  unsigned int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__pairT_unsigned_int_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PairUInt32Real32_first_get" "', argument " "1"" of type '" "std::pair< nupic::UInt32,nupic::Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::pair< nupic::UInt32,nupic::Real32 > * >(argp1);
  result = (unsigned int) ((arg1)->first);
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_PairUInt32Real32_second_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::pair< nupic::UInt32,nupic::Real32 > *arg1 = (std::pair< nupic::UInt32,nupic::Real32 > *) 0 ;
  float arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  float val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"PairUInt32Real32_second_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__pairT_unsigned_int_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PairUInt32Real32_second_set" "', argument " "1"" of type '" "std::pair< nupic::UInt32,nupic::Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::pair< nupic::UInt32,nupic::Real32 > * >(argp1);
  ecode2 = SWIG_AsVal_float(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "PairUInt32Real32_second_set" "', argument " "2"" of type '" "float""'");
  } 
  arg2 = static_cast< float >(val2);
  if (arg1) (arg1)->second = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_PairUInt32Real32_second_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::pair< nupic::UInt32,nupic::Real32 > *arg1 = (std::pair< nupic::UInt32,nupic::Real32 > *) 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_std__pairT_unsigned_int_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PairUInt32Real32_second_get" "', argument " "1"" of type '" "std::pair< nupic::UInt32,nupic::Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::pair< nupic::UInt32,nupic::Real32 > * >(argp1);
  result = (float) ((arg1)->second);
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_PairUInt32Real32(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::pair< nupic::UInt32,nupic::Real32 > *arg1 = (std::pair< nupic::UInt32,nupic::Real32 > *) 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__pairT_unsigned_int_float_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_PairUInt32Real32" "', argument " "1"" of type '" "std::pair< nupic::UInt32,nupic::Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< std::pair< nupic::UInt32,nupic::Real32 > * >(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 *PairUInt32Real32_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__pairT_unsigned_int_float_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new_PairUInt32Real64__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  std::pair< nupic::UInt32,nupic::Real64 > *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::pair< nupic::UInt32,nupic::Real64 > *)new std::pair< nupic::UInt32,nupic::Real64 >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__pairT_unsigned_int_double_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_PairUInt32Real64__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  unsigned int arg1 ;
  double arg2 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  std::pair< nupic::UInt32,nupic::Real64 > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  ecode1 = SWIG_AsVal_unsigned_SS_int(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_PairUInt32Real64" "', argument " "1"" of type '" "unsigned int""'");
  } 
  arg1 = static_cast< unsigned int >(val1);
  ecode2 = SWIG_AsVal_double(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_PairUInt32Real64" "', argument " "2"" of type '" "double""'");
  } 
  arg2 = static_cast< double >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::pair< nupic::UInt32,nupic::Real64 > *)new std::pair< nupic::UInt32,nupic::Real64 >(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_std__pairT_unsigned_int_double_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_PairUInt32Real64__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::pair< nupic::UInt32,nupic::Real64 > *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  std::pair< nupic::UInt32,nupic::Real64 > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  {
    std::pair<unsigned int,double > *ptr = (std::pair<unsigned int,double > *)0;
    res1 = swig::asptr(swig_obj[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_PairUInt32Real64" "', argument " "1"" of type '" "std::pair< nupic::UInt32,nupic::Real64 > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_PairUInt32Real64" "', argument " "1"" of type '" "std::pair< nupic::UInt32,nupic::Real64 > const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::pair< nupic::UInt32,nupic::Real64 > *)new std::pair< nupic::UInt32,nupic::Real64 >((std::pair< nupic::UInt32,nupic::Real64 > 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__pairT_unsigned_int_double_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_new_PairUInt32Real64(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_PairUInt32Real64",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::asptr(argv[0], (std::pair<unsigned int,double >**)(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_double(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_PairUInt32Real64__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_PairUInt32Real64__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_new_PairUInt32Real64__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_PairUInt32Real64'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::pair< nupic::UInt32,nupic::Real64 >::pair()\n"
    "    std::pair< nupic::UInt32,nupic::Real64 >::pair(unsigned int,double)\n"
    "    std::pair< nupic::UInt32,nupic::Real64 >::pair(std::pair< nupic::UInt32,nupic::Real64 > const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_PairUInt32Real64_first_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::pair< nupic::UInt32,nupic::Real64 > *arg1 = (std::pair< nupic::UInt32,nupic::Real64 > *) 0 ;
  unsigned int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"PairUInt32Real64_first_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__pairT_unsigned_int_double_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PairUInt32Real64_first_set" "', argument " "1"" of type '" "std::pair< nupic::UInt32,nupic::Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::pair< nupic::UInt32,nupic::Real64 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "PairUInt32Real64_first_set" "', argument " "2"" of type '" "unsigned int""'");
  } 
  arg2 = static_cast< unsigned int >(val2);
  if (arg1) (arg1)->first = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_PairUInt32Real64_first_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::pair< nupic::UInt32,nupic::Real64 > *arg1 = (std::pair< nupic::UInt32,nupic::Real64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  unsigned int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__pairT_unsigned_int_double_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PairUInt32Real64_first_get" "', argument " "1"" of type '" "std::pair< nupic::UInt32,nupic::Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::pair< nupic::UInt32,nupic::Real64 > * >(argp1);
  result = (unsigned int) ((arg1)->first);
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_PairUInt32Real64_second_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::pair< nupic::UInt32,nupic::Real64 > *arg1 = (std::pair< nupic::UInt32,nupic::Real64 > *) 0 ;
  double arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"PairUInt32Real64_second_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__pairT_unsigned_int_double_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PairUInt32Real64_second_set" "', argument " "1"" of type '" "std::pair< nupic::UInt32,nupic::Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::pair< nupic::UInt32,nupic::Real64 > * >(argp1);
  ecode2 = SWIG_AsVal_double(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "PairUInt32Real64_second_set" "', argument " "2"" of type '" "double""'");
  } 
  arg2 = static_cast< double >(val2);
  if (arg1) (arg1)->second = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_PairUInt32Real64_second_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::pair< nupic::UInt32,nupic::Real64 > *arg1 = (std::pair< nupic::UInt32,nupic::Real64 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  double result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__pairT_unsigned_int_double_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PairUInt32Real64_second_get" "', argument " "1"" of type '" "std::pair< nupic::UInt32,nupic::Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::pair< nupic::UInt32,nupic::Real64 > * >(argp1);
  result = (double) ((arg1)->second);
  resultobj = SWIG_From_double(static_cast< double >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_PairUInt32Real64(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::pair< nupic::UInt32,nupic::Real64 > *arg1 = (std::pair< nupic::UInt32,nupic::Real64 > *) 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__pairT_unsigned_int_double_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_PairUInt32Real64" "', argument " "1"" of type '" "std::pair< nupic::UInt32,nupic::Real64 > *""'"); 
  }
  arg1 = reinterpret_cast< std::pair< nupic::UInt32,nupic::Real64 > * >(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 *PairUInt32Real64_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__pairT_unsigned_int_double_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real32_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 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_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32_iterator" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (swig::SwigPyIterator *)std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__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_VectorOfPairsUInt32Real32___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 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_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32___nonzero__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__Sg____nonzero__((std::vector< std::pair< unsigned int,float > > 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_VectorOfPairsUInt32Real32___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 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_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32___bool__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__Sg____bool__((std::vector< std::pair< unsigned int,float > > 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_VectorOfPairsUInt32Real32___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::pair< unsigned int,float > >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32___len__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__Sg____len__((std::vector< std::pair< unsigned int,float > > 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_VectorOfPairsUInt32Real32_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::pair< unsigned int,float > >::value_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32_pop" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__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(static_cast< std::pair<unsigned int,float > >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real32___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 0 ;
  std::vector< std::pair< unsigned int,float > >::difference_type arg2 ;
  std::vector< std::pair< unsigned int,float > >::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< std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > > *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:VectorOfPairsUInt32Real32___getslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32___getslice__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfPairsUInt32Real32___getslice__" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,float > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< unsigned int,float > >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfPairsUInt32Real32___getslice__" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,float > >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< std::pair< unsigned int,float > >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > > *)std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__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_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real32___setslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 0 ;
  std::vector< std::pair< unsigned int,float > >::difference_type arg2 ;
  std::vector< std::pair< unsigned int,float > >::difference_type arg3 ;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > > const &arg4_defvalue = std::vector< std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > >() ;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > > *arg4 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > > *) &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:VectorOfPairsUInt32Real32___setslice__",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32___setslice__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfPairsUInt32Real32___setslice__" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,float > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< unsigned int,float > >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfPairsUInt32Real32___setslice__" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,float > >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< std::pair< unsigned int,float > >::difference_type >(val3);
  if (obj3) {
    {
      std::vector<std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > > *ptr = (std::vector<std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > > *)0;
      res4 = swig::asptr(obj3, &ptr);
      if (!SWIG_IsOK(res4)) {
        SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "VectorOfPairsUInt32Real32___setslice__" "', argument " "4"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > > const &""'"); 
      }
      if (!ptr) {
        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfPairsUInt32Real32___setslice__" "', argument " "4"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > > const &""'"); 
      }
      arg4 = ptr;
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__Sg____setslice__(arg1,arg2,arg3,(std::vector< std::pair< unsigned int,float >,std::allocator< std::pair< unsigned int,float > > > 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_VectorOfPairsUInt32Real32___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 0 ;
  std::vector< std::pair< unsigned int,float > >::difference_type arg2 ;
  std::vector< std::pair< unsigned int,float > >::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:VectorOfPairsUInt32Real32___delslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32___delslice__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfPairsUInt32Real32___delslice__" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,float > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< unsigned int,float > >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfPairsUInt32Real32___delslice__" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,float > >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< std::pair< unsigned int,float > >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__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_VectorOfPairsUInt32Real32___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 0 ;
  std::vector< std::pair< unsigned int,float > >::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_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32___delitem__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfPairsUInt32Real32___delitem__" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,float > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< unsigned int,float > >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__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_VectorOfPairsUInt32Real32___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32___getitem__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfPairsUInt32Real32___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< std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > > *)std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__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_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real32___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > > *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_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32___setitem__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfPairsUInt32Real32___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    std::vector<std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > > *ptr = (std::vector<std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VectorOfPairsUInt32Real32___setitem__" "', argument " "3"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfPairsUInt32Real32___setitem__" "', argument " "3"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > > const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__Sg____setitem____SWIG_0(arg1,arg2,(std::vector< std::pair< unsigned int,float >,std::allocator< std::pair< unsigned int,float > > > 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_VectorOfPairsUInt32Real32___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 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_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32___setitem__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfPairsUInt32Real32___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_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__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_VectorOfPairsUInt32Real32___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 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_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32___delitem__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfPairsUInt32Real32___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_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__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_VectorOfPairsUInt32Real32___delitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfPairsUInt32Real32___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<std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > >**)(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<std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > >**)(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_VectorOfPairsUInt32Real32___delitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_VectorOfPairsUInt32Real32___delitem____SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfPairsUInt32Real32___delitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real32 > >::__delitem__(std::vector< std::pair< unsigned int,float > >::difference_type)\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real32 > >::__delitem__(PySliceObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real32___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 0 ;
  std::vector< std::pair< unsigned int,float > >::difference_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  std::vector< std::pair< unsigned int,float > >::value_type *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32___getitem__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfPairsUInt32Real32___getitem__" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,float > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< unsigned int,float > >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< std::pair< unsigned int,float > >::value_type *) &std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__Sg____getitem____SWIG_1((std::vector< std::pair< unsigned int,float > > 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(static_cast< std::pair<unsigned int,float > >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real32___getitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfPairsUInt32Real32___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<std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > >**)(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<std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > >**)(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_VectorOfPairsUInt32Real32___getitem____SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfPairsUInt32Real32___getitem____SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfPairsUInt32Real32___getitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real32 > >::__getitem__(PySliceObject *)\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real32 > >::__getitem__(std::vector< std::pair< unsigned int,float > >::difference_type) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real32___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 0 ;
  std::vector< std::pair< unsigned int,float > >::difference_type arg2 ;
  std::vector< std::pair< unsigned int,float > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32___setitem__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfPairsUInt32Real32___setitem__" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,float > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< unsigned int,float > >::difference_type >(val2);
  {
    std::pair<unsigned int,float > *ptr = (std::pair<unsigned int,float > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VectorOfPairsUInt32Real32___setitem__" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,float > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfPairsUInt32Real32___setitem__" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,float > >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__Sg____setitem____SWIG_2(arg1,arg2,(std::pair< unsigned int,float > 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();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real32___setitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfPairsUInt32Real32___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<std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > >**)(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<std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > >**)(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<std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > >**)(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<std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > >**)(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::asptr(argv[2], (std::pair<unsigned int,float >**)(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_VectorOfPairsUInt32Real32___setitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_VectorOfPairsUInt32Real32___setitem____SWIG_0(self, argc, argv);
    case 3:
      return _wrap_VectorOfPairsUInt32Real32___setitem____SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfPairsUInt32Real32___setitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real32 > >::__setitem__(PySliceObject *,std::vector< std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > > const &)\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real32 > >::__setitem__(PySliceObject *)\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real32 > >::__setitem__(std::vector< std::pair< unsigned int,float > >::difference_type,std::vector< std::pair< unsigned int,float > >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real32_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 0 ;
  std::vector< std::pair< unsigned int,float > >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:VectorOfPairsUInt32Real32_append",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32_append" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(argp1);
  {
    std::pair<unsigned int,float > *ptr = (std::pair<unsigned int,float > *)0;
    res2 = swig::asptr(obj1, &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VectorOfPairsUInt32Real32_append" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,float > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfPairsUInt32Real32_append" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,float > >::value_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__Sg__append(arg1,(std::pair< unsigned int,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_Py_Void();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_VectorOfPairsUInt32Real32__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *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< std::pair< nupic::UInt32,nupic::Real32 > > *)new std::vector< std::pair< nupic::UInt32,nupic::Real32 > >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_VectorOfPairsUInt32Real32__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  {
    std::vector<std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > > *ptr = (std::vector<std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > > *)0;
    res1 = swig::asptr(swig_obj[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_VectorOfPairsUInt32Real32" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VectorOfPairsUInt32Real32" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *)new std::vector< std::pair< nupic::UInt32,nupic::Real32 > >((std::vector< std::pair< nupic::UInt32,nupic::Real32 > > 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_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_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_VectorOfPairsUInt32Real32_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 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_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32_empty" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((std::vector< std::pair< nupic::UInt32,nupic::Real32 > > 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_VectorOfPairsUInt32Real32_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::pair< unsigned int,float > >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32_size" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< std::pair< nupic::UInt32,nupic::Real32 > > 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_VectorOfPairsUInt32Real32_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 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_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32_clear" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(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_VectorOfPairsUInt32Real32_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 0 ;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *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:VectorOfPairsUInt32Real32_swap",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32_swap" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, 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(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VectorOfPairsUInt32Real32_swap" "', argument " "2"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfPairsUInt32Real32_swap" "', argument " "2"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(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_VectorOfPairsUInt32Real32_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::allocator< std::pair< unsigned int,float > > > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32_get_allocator" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< std::pair< nupic::UInt32,nupic::Real32 > > 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< std::pair< unsigned int,float > >::allocator_type(static_cast< const std::vector< std::pair< unsigned int,float > >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real32_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,float > >::iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32_begin" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(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< std::pair< unsigned int,float > >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real32_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,float > >::iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32_end" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(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< std::pair< unsigned int,float > >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real32_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,float > >::reverse_iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32_rbegin" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(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< std::pair< unsigned int,float > >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real32_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,float > >::reverse_iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32_rend" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(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< std::pair< unsigned int,float > >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_VectorOfPairsUInt32Real32__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< unsigned int,float > >::size_type arg1 ;
  size_t val1 ;
  int ecode1 = 0 ;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *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_VectorOfPairsUInt32Real32" "', argument " "1"" of type '" "std::vector< std::pair< unsigned int,float > >::size_type""'");
  } 
  arg1 = static_cast< std::vector< std::pair< unsigned int,float > >::size_type >(val1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *)new std::vector< std::pair< nupic::UInt32,nupic::Real32 > >(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_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real32_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 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_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32_pop_back" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(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_VectorOfPairsUInt32Real32_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 0 ;
  std::vector< std::pair< unsigned int,float > >::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_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32_resize" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfPairsUInt32Real32_resize" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,float > >::size_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< unsigned int,float > >::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_VectorOfPairsUInt32Real32_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 0 ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,float > >::iterator > arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,float > >::iterator > result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32_erase" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(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 '" "VectorOfPairsUInt32Real32_erase" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,float > >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::pair< unsigned int,float > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::pair< unsigned int,float > >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfPairsUInt32Real32_erase" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,float > >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__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< std::pair< unsigned int,float > >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real32_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 0 ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,float > >::iterator > arg2 ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,float > >::iterator > arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  swig::SwigPyIterator *iter3 = 0 ;
  int res3 ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,float > >::iterator > result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32_erase" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(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 '" "VectorOfPairsUInt32Real32_erase" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,float > >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::pair< unsigned int,float > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::pair< unsigned int,float > >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfPairsUInt32Real32_erase" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,float > >::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 '" "VectorOfPairsUInt32Real32_erase" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,float > >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::pair< unsigned int,float > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::pair< unsigned int,float > >::iterator > *>(iter3);
    if (iter_t) {
      arg3 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfPairsUInt32Real32_erase" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,float > >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__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< std::pair< unsigned int,float > >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real32_erase(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfPairsUInt32Real32_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<std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > >**)(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< std::pair< unsigned int,float > >::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<std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > >**)(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< std::pair< unsigned int,float > >::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< std::pair< unsigned int,float > >::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_VectorOfPairsUInt32Real32_erase__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfPairsUInt32Real32_erase__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfPairsUInt32Real32_erase'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real32 > >::erase(std::vector< std::pair< unsigned int,float > >::iterator)\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real32 > >::erase(std::vector< std::pair< unsigned int,float > >::iterator,std::vector< std::pair< unsigned int,float > >::iterator)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_new_VectorOfPairsUInt32Real32__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< unsigned int,float > >::size_type arg1 ;
  std::vector< std::pair< unsigned int,float > >::value_type *arg2 = 0 ;
  size_t val1 ;
  int ecode1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *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_VectorOfPairsUInt32Real32" "', argument " "1"" of type '" "std::vector< std::pair< unsigned int,float > >::size_type""'");
  } 
  arg1 = static_cast< std::vector< std::pair< unsigned int,float > >::size_type >(val1);
  {
    std::pair<unsigned int,float > *ptr = (std::pair<unsigned int,float > *)0;
    res2 = swig::asptr(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_VectorOfPairsUInt32Real32" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,float > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VectorOfPairsUInt32Real32" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,float > >::value_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *)new std::vector< std::pair< nupic::UInt32,nupic::Real32 > >(arg1,(std::vector< std::pair< unsigned int,float > >::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_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, SWIG_POINTER_NEW |  0 );
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_VectorOfPairsUInt32Real32(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_VectorOfPairsUInt32Real32",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<std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > >**)(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::asptr(argv[1], (std::pair<unsigned int,float >**)(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_VectorOfPairsUInt32Real32__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_VectorOfPairsUInt32Real32__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_new_VectorOfPairsUInt32Real32__SWIG_1(self, argc, argv);
    case 4:
      return _wrap_new_VectorOfPairsUInt32Real32__SWIG_3(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_VectorOfPairsUInt32Real32'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real32 > >::vector()\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real32 > >::vector(std::vector< std::pair< nupic::UInt32,nupic::Real32 > > const &)\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real32 > >::vector(std::vector< std::pair< unsigned int,float > >::size_type)\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real32 > >::vector(std::vector< std::pair< unsigned int,float > >::size_type,std::vector< std::pair< unsigned int,float > >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real32_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 0 ;
  std::vector< std::pair< unsigned int,float > >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:VectorOfPairsUInt32Real32_push_back",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32_push_back" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(argp1);
  {
    std::pair<unsigned int,float > *ptr = (std::pair<unsigned int,float > *)0;
    res2 = swig::asptr(obj1, &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VectorOfPairsUInt32Real32_push_back" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,float > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfPairsUInt32Real32_push_back" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,float > >::value_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->push_back((std::vector< std::pair< unsigned int,float > >::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();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real32_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::pair< unsigned int,float > >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32_front" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::pair< unsigned int,float > >::value_type *) &((std::vector< std::pair< nupic::UInt32,nupic::Real32 > > 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(static_cast< std::pair<unsigned int,float > >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real32_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::pair< unsigned int,float > >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32_back" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::pair< unsigned int,float > >::value_type *) &((std::vector< std::pair< nupic::UInt32,nupic::Real32 > > 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(static_cast< std::pair<unsigned int,float > >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real32_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 0 ;
  std::vector< std::pair< unsigned int,float > >::size_type arg2 ;
  std::vector< std::pair< unsigned int,float > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  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:VectorOfPairsUInt32Real32_assign",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32_assign" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfPairsUInt32Real32_assign" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,float > >::size_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< unsigned int,float > >::size_type >(val2);
  {
    std::pair<unsigned int,float > *ptr = (std::pair<unsigned int,float > *)0;
    res3 = swig::asptr(obj2, &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VectorOfPairsUInt32Real32_assign" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,float > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfPairsUInt32Real32_assign" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,float > >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->assign(arg2,(std::vector< std::pair< unsigned int,float > >::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();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real32_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 0 ;
  std::vector< std::pair< unsigned int,float > >::size_type arg2 ;
  std::vector< std::pair< unsigned int,float > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32_resize" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfPairsUInt32Real32_resize" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,float > >::size_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< unsigned int,float > >::size_type >(val2);
  {
    std::pair<unsigned int,float > *ptr = (std::pair<unsigned int,float > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VectorOfPairsUInt32Real32_resize" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,float > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfPairsUInt32Real32_resize" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,float > >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resize(arg2,(std::vector< std::pair< unsigned int,float > >::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();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real32_resize(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfPairsUInt32Real32_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<std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > >**)(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<std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > >**)(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::asptr(argv[2], (std::pair<unsigned int,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_VectorOfPairsUInt32Real32_resize__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfPairsUInt32Real32_resize__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfPairsUInt32Real32_resize'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real32 > >::resize(std::vector< std::pair< unsigned int,float > >::size_type)\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real32 > >::resize(std::vector< std::pair< unsigned int,float > >::size_type,std::vector< std::pair< unsigned int,float > >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real32_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 0 ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,float > >::iterator > arg2 ;
  std::vector< std::pair< unsigned int,float > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  int res3 = SWIG_OLDOBJ ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,float > >::iterator > result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32_insert" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(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 '" "VectorOfPairsUInt32Real32_insert" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,float > >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::pair< unsigned int,float > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::pair< unsigned int,float > >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfPairsUInt32Real32_insert" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,float > >::iterator""'");
    }
  }
  {
    std::pair<unsigned int,float > *ptr = (std::pair<unsigned int,float > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VectorOfPairsUInt32Real32_insert" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,float > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfPairsUInt32Real32_insert" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,float > >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__Sg__insert__SWIG_0(arg1,arg2,(std::pair< unsigned int,float > 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< std::pair< unsigned int,float > >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real32_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 0 ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,float > >::iterator > arg2 ;
  std::vector< std::pair< unsigned int,float > >::size_type arg3 ;
  std::vector< std::pair< unsigned int,float > >::value_type *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  size_t val3 ;
  int ecode3 = 0 ;
  int res4 = SWIG_OLDOBJ ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32_insert" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(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 '" "VectorOfPairsUInt32Real32_insert" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,float > >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::pair< unsigned int,float > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::pair< unsigned int,float > >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfPairsUInt32Real32_insert" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,float > >::iterator""'");
    }
  }
  ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfPairsUInt32Real32_insert" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,float > >::size_type""'");
  } 
  arg3 = static_cast< std::vector< std::pair< unsigned int,float > >::size_type >(val3);
  {
    std::pair<unsigned int,float > *ptr = (std::pair<unsigned int,float > *)0;
    res4 = swig::asptr(swig_obj[3], &ptr);
    if (!SWIG_IsOK(res4)) {
      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "VectorOfPairsUInt32Real32_insert" "', argument " "4"" of type '" "std::vector< std::pair< unsigned int,float > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfPairsUInt32Real32_insert" "', argument " "4"" of type '" "std::vector< std::pair< unsigned int,float > >::value_type const &""'"); 
    }
    arg4 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real32_Sg__Sg__insert__SWIG_1(arg1,arg2,arg3,(std::pair< unsigned int,float > 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_VectorOfPairsUInt32Real32_insert(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfPairsUInt32Real32_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<std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > >**)(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< std::pair< unsigned int,float > >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = swig::asptr(argv[2], (std::pair<unsigned int,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 == 4) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > >**)(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< std::pair< unsigned int,float > >::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::asptr(argv[3], (std::pair<unsigned int,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_VectorOfPairsUInt32Real32_insert__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfPairsUInt32Real32_insert__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfPairsUInt32Real32_insert'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real32 > >::insert(std::vector< std::pair< unsigned int,float > >::iterator,std::vector< std::pair< unsigned int,float > >::value_type const &)\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real32 > >::insert(std::vector< std::pair< unsigned int,float > >::iterator,std::vector< std::pair< unsigned int,float > >::size_type,std::vector< std::pair< unsigned int,float > >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real32_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 0 ;
  std::vector< std::pair< unsigned int,float > >::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:VectorOfPairsUInt32Real32_reserve",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32_reserve" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfPairsUInt32Real32_reserve" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,float > >::size_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< unsigned int,float > >::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_VectorOfPairsUInt32Real32_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::pair< unsigned int,float > >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real32_capacity" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< std::pair< nupic::UInt32,nupic::Real32 > > 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_VectorOfPairsUInt32Real32(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *) 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_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_VectorOfPairsUInt32Real32" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real32 > > * >(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 *VectorOfPairsUInt32Real32_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_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real64_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 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_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64_iterator" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (swig::SwigPyIterator *)std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__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_VectorOfPairsUInt32Real64___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 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_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64___nonzero__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__Sg____nonzero__((std::vector< std::pair< unsigned int,double > > 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_VectorOfPairsUInt32Real64___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 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_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64___bool__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__Sg____bool__((std::vector< std::pair< unsigned int,double > > 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_VectorOfPairsUInt32Real64___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::pair< unsigned int,double > >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64___len__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__Sg____len__((std::vector< std::pair< unsigned int,double > > 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_VectorOfPairsUInt32Real64_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::pair< unsigned int,double > >::value_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64_pop" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__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(static_cast< std::pair<unsigned int,double > >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real64___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 0 ;
  std::vector< std::pair< unsigned int,double > >::difference_type arg2 ;
  std::vector< std::pair< unsigned int,double > >::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< std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > > *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:VectorOfPairsUInt32Real64___getslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64___getslice__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfPairsUInt32Real64___getslice__" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,double > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< unsigned int,double > >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfPairsUInt32Real64___getslice__" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,double > >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< std::pair< unsigned int,double > >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > > *)std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__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_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real64___setslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 0 ;
  std::vector< std::pair< unsigned int,double > >::difference_type arg2 ;
  std::vector< std::pair< unsigned int,double > >::difference_type arg3 ;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > > const &arg4_defvalue = std::vector< std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > >() ;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > > *arg4 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > > *) &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:VectorOfPairsUInt32Real64___setslice__",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64___setslice__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfPairsUInt32Real64___setslice__" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,double > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< unsigned int,double > >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfPairsUInt32Real64___setslice__" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,double > >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< std::pair< unsigned int,double > >::difference_type >(val3);
  if (obj3) {
    {
      std::vector<std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > > *ptr = (std::vector<std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > > *)0;
      res4 = swig::asptr(obj3, &ptr);
      if (!SWIG_IsOK(res4)) {
        SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "VectorOfPairsUInt32Real64___setslice__" "', argument " "4"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > > const &""'"); 
      }
      if (!ptr) {
        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfPairsUInt32Real64___setslice__" "', argument " "4"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > > const &""'"); 
      }
      arg4 = ptr;
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__Sg____setslice__(arg1,arg2,arg3,(std::vector< std::pair< unsigned int,double >,std::allocator< std::pair< unsigned int,double > > > 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_VectorOfPairsUInt32Real64___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 0 ;
  std::vector< std::pair< unsigned int,double > >::difference_type arg2 ;
  std::vector< std::pair< unsigned int,double > >::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:VectorOfPairsUInt32Real64___delslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64___delslice__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfPairsUInt32Real64___delslice__" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,double > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< unsigned int,double > >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfPairsUInt32Real64___delslice__" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,double > >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< std::pair< unsigned int,double > >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__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_VectorOfPairsUInt32Real64___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 0 ;
  std::vector< std::pair< unsigned int,double > >::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_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64___delitem__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfPairsUInt32Real64___delitem__" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,double > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< unsigned int,double > >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__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_VectorOfPairsUInt32Real64___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64___getitem__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfPairsUInt32Real64___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< std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > > *)std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__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_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real64___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > > *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_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64___setitem__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfPairsUInt32Real64___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    std::vector<std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > > *ptr = (std::vector<std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VectorOfPairsUInt32Real64___setitem__" "', argument " "3"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfPairsUInt32Real64___setitem__" "', argument " "3"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > > const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__Sg____setitem____SWIG_0(arg1,arg2,(std::vector< std::pair< unsigned int,double >,std::allocator< std::pair< unsigned int,double > > > 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_VectorOfPairsUInt32Real64___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 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_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64___setitem__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfPairsUInt32Real64___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_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__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_VectorOfPairsUInt32Real64___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 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_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64___delitem__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfPairsUInt32Real64___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_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__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_VectorOfPairsUInt32Real64___delitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfPairsUInt32Real64___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<std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > >**)(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<std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > >**)(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_VectorOfPairsUInt32Real64___delitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_VectorOfPairsUInt32Real64___delitem____SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfPairsUInt32Real64___delitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real64 > >::__delitem__(std::vector< std::pair< unsigned int,double > >::difference_type)\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real64 > >::__delitem__(PySliceObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real64___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 0 ;
  std::vector< std::pair< unsigned int,double > >::difference_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  std::vector< std::pair< unsigned int,double > >::value_type *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64___getitem__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfPairsUInt32Real64___getitem__" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,double > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< unsigned int,double > >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< std::pair< unsigned int,double > >::value_type *) &std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__Sg____getitem____SWIG_1((std::vector< std::pair< unsigned int,double > > 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(static_cast< std::pair<unsigned int,double > >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real64___getitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfPairsUInt32Real64___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<std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > >**)(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<std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > >**)(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_VectorOfPairsUInt32Real64___getitem____SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfPairsUInt32Real64___getitem____SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfPairsUInt32Real64___getitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real64 > >::__getitem__(PySliceObject *)\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real64 > >::__getitem__(std::vector< std::pair< unsigned int,double > >::difference_type) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real64___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 0 ;
  std::vector< std::pair< unsigned int,double > >::difference_type arg2 ;
  std::vector< std::pair< unsigned int,double > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64___setitem__" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfPairsUInt32Real64___setitem__" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,double > >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< unsigned int,double > >::difference_type >(val2);
  {
    std::pair<unsigned int,double > *ptr = (std::pair<unsigned int,double > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VectorOfPairsUInt32Real64___setitem__" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,double > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfPairsUInt32Real64___setitem__" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,double > >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__Sg____setitem____SWIG_2(arg1,arg2,(std::pair< unsigned int,double > 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();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real64___setitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfPairsUInt32Real64___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<std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > >**)(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<std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > >**)(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<std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > >**)(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<std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > >**)(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::asptr(argv[2], (std::pair<unsigned int,double >**)(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_VectorOfPairsUInt32Real64___setitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_VectorOfPairsUInt32Real64___setitem____SWIG_0(self, argc, argv);
    case 3:
      return _wrap_VectorOfPairsUInt32Real64___setitem____SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfPairsUInt32Real64___setitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real64 > >::__setitem__(PySliceObject *,std::vector< std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > > const &)\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real64 > >::__setitem__(PySliceObject *)\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real64 > >::__setitem__(std::vector< std::pair< unsigned int,double > >::difference_type,std::vector< std::pair< unsigned int,double > >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real64_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 0 ;
  std::vector< std::pair< unsigned int,double > >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:VectorOfPairsUInt32Real64_append",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64_append" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(argp1);
  {
    std::pair<unsigned int,double > *ptr = (std::pair<unsigned int,double > *)0;
    res2 = swig::asptr(obj1, &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VectorOfPairsUInt32Real64_append" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,double > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfPairsUInt32Real64_append" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,double > >::value_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__Sg__append(arg1,(std::pair< unsigned int,double > 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_new_VectorOfPairsUInt32Real64__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *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< std::pair< nupic::UInt32,nupic::Real64 > > *)new std::vector< std::pair< nupic::UInt32,nupic::Real64 > >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_VectorOfPairsUInt32Real64__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  {
    std::vector<std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > > *ptr = (std::vector<std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > > *)0;
    res1 = swig::asptr(swig_obj[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_VectorOfPairsUInt32Real64" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VectorOfPairsUInt32Real64" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *)new std::vector< std::pair< nupic::UInt32,nupic::Real64 > >((std::vector< std::pair< nupic::UInt32,nupic::Real64 > > 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_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_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_VectorOfPairsUInt32Real64_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 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_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64_empty" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((std::vector< std::pair< nupic::UInt32,nupic::Real64 > > 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_VectorOfPairsUInt32Real64_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::pair< unsigned int,double > >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64_size" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< std::pair< nupic::UInt32,nupic::Real64 > > 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_VectorOfPairsUInt32Real64_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 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_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64_clear" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(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_VectorOfPairsUInt32Real64_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 0 ;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *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:VectorOfPairsUInt32Real64_swap",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64_swap" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VectorOfPairsUInt32Real64_swap" "', argument " "2"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfPairsUInt32Real64_swap" "', argument " "2"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(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_VectorOfPairsUInt32Real64_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::allocator< std::pair< unsigned int,double > > > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64_get_allocator" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< std::pair< nupic::UInt32,nupic::Real64 > > 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< std::pair< unsigned int,double > >::allocator_type(static_cast< const std::vector< std::pair< unsigned int,double > >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real64_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,double > >::iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64_begin" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(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< std::pair< unsigned int,double > >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real64_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,double > >::iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64_end" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(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< std::pair< unsigned int,double > >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real64_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,double > >::reverse_iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64_rbegin" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(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< std::pair< unsigned int,double > >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real64_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,double > >::reverse_iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64_rend" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(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< std::pair< unsigned int,double > >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_VectorOfPairsUInt32Real64__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< unsigned int,double > >::size_type arg1 ;
  size_t val1 ;
  int ecode1 = 0 ;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *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_VectorOfPairsUInt32Real64" "', argument " "1"" of type '" "std::vector< std::pair< unsigned int,double > >::size_type""'");
  } 
  arg1 = static_cast< std::vector< std::pair< unsigned int,double > >::size_type >(val1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *)new std::vector< std::pair< nupic::UInt32,nupic::Real64 > >(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_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real64_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 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_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64_pop_back" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(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_VectorOfPairsUInt32Real64_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 0 ;
  std::vector< std::pair< unsigned int,double > >::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_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64_resize" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfPairsUInt32Real64_resize" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,double > >::size_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< unsigned int,double > >::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_VectorOfPairsUInt32Real64_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 0 ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,double > >::iterator > arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,double > >::iterator > result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64_erase" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(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 '" "VectorOfPairsUInt32Real64_erase" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,double > >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::pair< unsigned int,double > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::pair< unsigned int,double > >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfPairsUInt32Real64_erase" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,double > >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__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< std::pair< unsigned int,double > >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real64_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 0 ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,double > >::iterator > arg2 ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,double > >::iterator > arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  swig::SwigPyIterator *iter3 = 0 ;
  int res3 ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,double > >::iterator > result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64_erase" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(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 '" "VectorOfPairsUInt32Real64_erase" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,double > >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::pair< unsigned int,double > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::pair< unsigned int,double > >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfPairsUInt32Real64_erase" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,double > >::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 '" "VectorOfPairsUInt32Real64_erase" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,double > >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::pair< unsigned int,double > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::pair< unsigned int,double > >::iterator > *>(iter3);
    if (iter_t) {
      arg3 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfPairsUInt32Real64_erase" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,double > >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__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< std::pair< unsigned int,double > >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real64_erase(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfPairsUInt32Real64_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<std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > >**)(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< std::pair< unsigned int,double > >::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<std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > >**)(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< std::pair< unsigned int,double > >::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< std::pair< unsigned int,double > >::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_VectorOfPairsUInt32Real64_erase__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfPairsUInt32Real64_erase__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfPairsUInt32Real64_erase'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real64 > >::erase(std::vector< std::pair< unsigned int,double > >::iterator)\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real64 > >::erase(std::vector< std::pair< unsigned int,double > >::iterator,std::vector< std::pair< unsigned int,double > >::iterator)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_new_VectorOfPairsUInt32Real64__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< unsigned int,double > >::size_type arg1 ;
  std::vector< std::pair< unsigned int,double > >::value_type *arg2 = 0 ;
  size_t val1 ;
  int ecode1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *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_VectorOfPairsUInt32Real64" "', argument " "1"" of type '" "std::vector< std::pair< unsigned int,double > >::size_type""'");
  } 
  arg1 = static_cast< std::vector< std::pair< unsigned int,double > >::size_type >(val1);
  {
    std::pair<unsigned int,double > *ptr = (std::pair<unsigned int,double > *)0;
    res2 = swig::asptr(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_VectorOfPairsUInt32Real64" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,double > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VectorOfPairsUInt32Real64" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,double > >::value_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *)new std::vector< std::pair< nupic::UInt32,nupic::Real64 > >(arg1,(std::vector< std::pair< unsigned int,double > >::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_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, SWIG_POINTER_NEW |  0 );
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_VectorOfPairsUInt32Real64(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_VectorOfPairsUInt32Real64",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<std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > >**)(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::asptr(argv[1], (std::pair<unsigned int,double >**)(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_VectorOfPairsUInt32Real64__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_VectorOfPairsUInt32Real64__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_new_VectorOfPairsUInt32Real64__SWIG_1(self, argc, argv);
    case 4:
      return _wrap_new_VectorOfPairsUInt32Real64__SWIG_3(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_VectorOfPairsUInt32Real64'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real64 > >::vector()\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real64 > >::vector(std::vector< std::pair< nupic::UInt32,nupic::Real64 > > const &)\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real64 > >::vector(std::vector< std::pair< unsigned int,double > >::size_type)\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real64 > >::vector(std::vector< std::pair< unsigned int,double > >::size_type,std::vector< std::pair< unsigned int,double > >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real64_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 0 ;
  std::vector< std::pair< unsigned int,double > >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:VectorOfPairsUInt32Real64_push_back",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64_push_back" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(argp1);
  {
    std::pair<unsigned int,double > *ptr = (std::pair<unsigned int,double > *)0;
    res2 = swig::asptr(obj1, &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VectorOfPairsUInt32Real64_push_back" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,double > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfPairsUInt32Real64_push_back" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,double > >::value_type const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->push_back((std::vector< std::pair< unsigned int,double > >::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();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real64_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::pair< unsigned int,double > >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64_front" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::pair< unsigned int,double > >::value_type *) &((std::vector< std::pair< nupic::UInt32,nupic::Real64 > > 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(static_cast< std::pair<unsigned int,double > >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real64_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::pair< unsigned int,double > >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64_back" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< std::pair< unsigned int,double > >::value_type *) &((std::vector< std::pair< nupic::UInt32,nupic::Real64 > > 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(static_cast< std::pair<unsigned int,double > >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real64_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 0 ;
  std::vector< std::pair< unsigned int,double > >::size_type arg2 ;
  std::vector< std::pair< unsigned int,double > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  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:VectorOfPairsUInt32Real64_assign",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64_assign" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfPairsUInt32Real64_assign" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,double > >::size_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< unsigned int,double > >::size_type >(val2);
  {
    std::pair<unsigned int,double > *ptr = (std::pair<unsigned int,double > *)0;
    res3 = swig::asptr(obj2, &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VectorOfPairsUInt32Real64_assign" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,double > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfPairsUInt32Real64_assign" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,double > >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->assign(arg2,(std::vector< std::pair< unsigned int,double > >::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();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real64_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 0 ;
  std::vector< std::pair< unsigned int,double > >::size_type arg2 ;
  std::vector< std::pair< unsigned int,double > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64_resize" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfPairsUInt32Real64_resize" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,double > >::size_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< unsigned int,double > >::size_type >(val2);
  {
    std::pair<unsigned int,double > *ptr = (std::pair<unsigned int,double > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VectorOfPairsUInt32Real64_resize" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,double > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfPairsUInt32Real64_resize" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,double > >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resize(arg2,(std::vector< std::pair< unsigned int,double > >::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();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real64_resize(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfPairsUInt32Real64_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<std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > >**)(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<std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > >**)(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::asptr(argv[2], (std::pair<unsigned int,double >**)(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_VectorOfPairsUInt32Real64_resize__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfPairsUInt32Real64_resize__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfPairsUInt32Real64_resize'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real64 > >::resize(std::vector< std::pair< unsigned int,double > >::size_type)\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real64 > >::resize(std::vector< std::pair< unsigned int,double > >::size_type,std::vector< std::pair< unsigned int,double > >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real64_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 0 ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,double > >::iterator > arg2 ;
  std::vector< std::pair< unsigned int,double > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  int res3 = SWIG_OLDOBJ ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,double > >::iterator > result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64_insert" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(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 '" "VectorOfPairsUInt32Real64_insert" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,double > >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::pair< unsigned int,double > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::pair< unsigned int,double > >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfPairsUInt32Real64_insert" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,double > >::iterator""'");
    }
  }
  {
    std::pair<unsigned int,double > *ptr = (std::pair<unsigned int,double > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VectorOfPairsUInt32Real64_insert" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,double > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfPairsUInt32Real64_insert" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,double > >::value_type const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__Sg__insert__SWIG_0(arg1,arg2,(std::pair< unsigned int,double > 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< std::pair< unsigned int,double > >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real64_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 0 ;
  SwigValueWrapper< std::vector< std::pair< unsigned int,double > >::iterator > arg2 ;
  std::vector< std::pair< unsigned int,double > >::size_type arg3 ;
  std::vector< std::pair< unsigned int,double > >::value_type *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  size_t val3 ;
  int ecode3 = 0 ;
  int res4 = SWIG_OLDOBJ ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64_insert" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(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 '" "VectorOfPairsUInt32Real64_insert" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,double > >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< std::pair< unsigned int,double > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::pair< unsigned int,double > >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorOfPairsUInt32Real64_insert" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,double > >::iterator""'");
    }
  }
  ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorOfPairsUInt32Real64_insert" "', argument " "3"" of type '" "std::vector< std::pair< unsigned int,double > >::size_type""'");
  } 
  arg3 = static_cast< std::vector< std::pair< unsigned int,double > >::size_type >(val3);
  {
    std::pair<unsigned int,double > *ptr = (std::pair<unsigned int,double > *)0;
    res4 = swig::asptr(swig_obj[3], &ptr);
    if (!SWIG_IsOK(res4)) {
      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "VectorOfPairsUInt32Real64_insert" "', argument " "4"" of type '" "std::vector< std::pair< unsigned int,double > >::value_type const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorOfPairsUInt32Real64_insert" "', argument " "4"" of type '" "std::vector< std::pair< unsigned int,double > >::value_type const &""'"); 
    }
    arg4 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_vector_Sl_std_pair_Sl_nupic_UInt32_Sc_nupic_Real64_Sg__Sg__insert__SWIG_1(arg1,arg2,arg3,(std::pair< unsigned int,double > 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_VectorOfPairsUInt32Real64_insert(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"VectorOfPairsUInt32Real64_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<std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > >**)(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< std::pair< unsigned int,double > >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = swig::asptr(argv[2], (std::pair<unsigned int,double >**)(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;
      {
        int res = swig::asptr(argv[0], (std::vector<std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > >**)(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< std::pair< unsigned int,double > >::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::asptr(argv[3], (std::pair<unsigned int,double >**)(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_VectorOfPairsUInt32Real64_insert__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_VectorOfPairsUInt32Real64_insert__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorOfPairsUInt32Real64_insert'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real64 > >::insert(std::vector< std::pair< unsigned int,double > >::iterator,std::vector< std::pair< unsigned int,double > >::value_type const &)\n"
    "    std::vector< std::pair< nupic::UInt32,nupic::Real64 > >::insert(std::vector< std::pair< unsigned int,double > >::iterator,std::vector< std::pair< unsigned int,double > >::size_type,std::vector< std::pair< unsigned int,double > >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_VectorOfPairsUInt32Real64_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 0 ;
  std::vector< std::pair< unsigned int,double > >::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:VectorOfPairsUInt32Real64_reserve",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64_reserve" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorOfPairsUInt32Real64_reserve" "', argument " "2"" of type '" "std::vector< std::pair< unsigned int,double > >::size_type""'");
  } 
  arg2 = static_cast< std::vector< std::pair< unsigned int,double > >::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_VectorOfPairsUInt32Real64_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::pair< unsigned int,double > >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorOfPairsUInt32Real64_capacity" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< std::pair< nupic::UInt32,nupic::Real64 > > 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_VectorOfPairsUInt32Real64(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *arg1 = (std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *) 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_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_VectorOfPairsUInt32Real64" "', argument " "1"" of type '" "std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< std::pair< nupic::UInt32,nupic::Real64 > > * >(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 *VectorOfPairsUInt32Real64_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_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_GetBasicTypeFromName(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::string *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  char *  kwnames[] = {
    (char *) "type", NULL 
  };
  NTA_BasicType result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:GetBasicTypeFromName",kwnames,&obj0)) SWIG_fail;
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(obj0, &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GetBasicTypeFromName" "', argument " "1"" of type '" "std::string const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "GetBasicTypeFromName" "', argument " "1"" of type '" "std::string const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (NTA_BasicType)GetBasicTypeFromName((std::string 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_int(static_cast< int >(result));
  if (SWIG_IsNewObj(res1)) delete arg1;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return NULL;
}


SWIGINTERN PyObject *_wrap_GetBasicTypeSize(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::string *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  char *  kwnames[] = {
    (char *) "type", NULL 
  };
  size_t result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:GetBasicTypeSize",kwnames,&obj0)) SWIG_fail;
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(obj0, &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GetBasicTypeSize" "', argument " "1"" of type '" "std::string const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "GetBasicTypeSize" "', argument " "1"" of type '" "std::string const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = GetBasicTypeSize((std::string 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));
  if (SWIG_IsNewObj(res1)) delete arg1;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return NULL;
}


SWIGINTERN PyObject *_wrap_getGlobalEpsilon(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Real result;
  
  if (!SWIG_Python_UnpackTuple(args,"getGlobalEpsilon",0,0,0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real)getGlobalEpsilon();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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_INVARIANT(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  bool arg1 ;
  char *arg2 = (char *) 0 ;
  bool val1 ;
  int ecode1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "cond",(char *) "msg", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:INVARIANT",kwnames,&obj0,&obj1)) SWIG_fail;
  ecode1 = SWIG_AsVal_bool(obj0, &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "INVARIANT" "', argument " "1"" of type '" "bool""'");
  } 
  arg1 = static_cast< bool >(val1);
  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "INVARIANT" "', 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 = (bool)nupic::INVARIANT(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_From_bool(static_cast< bool >(result));
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return NULL;
}


SWIGINTERN int Swig_var_Epsilon_set(PyObject *) {
  SWIG_Error(SWIG_AttributeError,"Variable Epsilon is read-only.");
  return 1;
}


SWIGINTERN PyObject *Swig_var_Epsilon_get(void) {
  PyObject *pyobj = 0;
  
  pyobj = SWIG_From_float(static_cast< float >(nupic::Epsilon));
  return pyobj;
}


SWIGINTERN PyObject *_wrap_emod(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  int arg1 ;
  int arg2 ;
  int val1 ;
  int ecode1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "x",(char *) "m", NULL 
  };
  int result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:emod",kwnames,&obj0,&obj1)) SWIG_fail;
  ecode1 = SWIG_AsVal_int(obj0, &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "emod" "', 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 '" "emod" "', 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::emod(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_new_SparseMatrixAlgorithms(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrixAlgorithms *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args,"new_SparseMatrixAlgorithms",0,0,0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrixAlgorithms *)new nupic::SparseMatrixAlgorithms();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__SparseMatrixAlgorithms, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_SparseMatrixAlgorithms(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrixAlgorithms *arg1 = (nupic::SparseMatrixAlgorithms *) 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__SparseMatrixAlgorithms, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_SparseMatrixAlgorithms" "', argument " "1"" of type '" "nupic::SparseMatrixAlgorithms *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrixAlgorithms * >(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 *SparseMatrixAlgorithms_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__SparseMatrixAlgorithms, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new_LogSumApprox(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  int arg1 = (int) 5000000 ;
  nupic::LogSumApprox::value_type arg2 = (nupic::LogSumApprox::value_type) -28 ;
  nupic::LogSumApprox::value_type arg3 = (nupic::LogSumApprox::value_type) 28 ;
  bool arg4 = (bool) false ;
  int val1 ;
  int ecode1 = 0 ;
  float val2 ;
  int ecode2 = 0 ;
  float val3 ;
  int ecode3 = 0 ;
  bool val4 ;
  int ecode4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "n_",(char *) "min_a_",(char *) "max_a_",(char *) "trace_", NULL 
  };
  nupic::LogSumApprox *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOOO:new_LogSumApprox",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  if (obj0) {
    ecode1 = SWIG_AsVal_int(obj0, &val1);
    if (!SWIG_IsOK(ecode1)) {
      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_LogSumApprox" "', argument " "1"" of type '" "int""'");
    } 
    arg1 = static_cast< int >(val1);
  }
  if (obj1) {
    ecode2 = SWIG_AsVal_float(obj1, &val2);
    if (!SWIG_IsOK(ecode2)) {
      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_LogSumApprox" "', argument " "2"" of type '" "nupic::LogSumApprox::value_type""'");
    } 
    arg2 = static_cast< nupic::LogSumApprox::value_type >(val2);
  }
  if (obj2) {
    ecode3 = SWIG_AsVal_float(obj2, &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "new_LogSumApprox" "', argument " "3"" of type '" "nupic::LogSumApprox::value_type""'");
    } 
    arg3 = static_cast< nupic::LogSumApprox::value_type >(val3);
  }
  if (obj3) {
    ecode4 = SWIG_AsVal_bool(obj3, &val4);
    if (!SWIG_IsOK(ecode4)) {
      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "new_LogSumApprox" "', 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::LogSumApprox *)new nupic::LogSumApprox(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__LogSumApprox, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


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


SWIGINTERN PyObject *_wrap_LogSumApprox_index(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::LogSumApprox *arg1 = (nupic::LogSumApprox *) 0 ;
  nupic::LogSumApprox::value_type arg2 ;
  nupic::LogSumApprox::value_type arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  float val2 ;
  int ecode2 = 0 ;
  float val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "a",(char *) "b", NULL 
  };
  int result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:LogSumApprox_index",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__LogSumApprox, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "LogSumApprox_index" "', argument " "1"" of type '" "nupic::LogSumApprox const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::LogSumApprox * >(argp1);
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "LogSumApprox_index" "', argument " "2"" of type '" "nupic::LogSumApprox::value_type""'");
  } 
  arg2 = static_cast< nupic::LogSumApprox::value_type >(val2);
  ecode3 = SWIG_AsVal_float(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "LogSumApprox_index" "', argument " "3"" of type '" "nupic::LogSumApprox::value_type""'");
  } 
  arg3 = static_cast< nupic::LogSumApprox::value_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (int)((nupic::LogSumApprox const *)arg1)->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_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_LogSumApprox_fast_sum_of_logs(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::LogSumApprox *arg1 = (nupic::LogSumApprox *) 0 ;
  nupic::LogSumApprox::value_type arg2 ;
  nupic::LogSumApprox::value_type arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  float val2 ;
  int ecode2 = 0 ;
  float val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "a",(char *) "b", NULL 
  };
  nupic::LogSumApprox::value_type result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:LogSumApprox_fast_sum_of_logs",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__LogSumApprox, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "LogSumApprox_fast_sum_of_logs" "', argument " "1"" of type '" "nupic::LogSumApprox const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::LogSumApprox * >(argp1);
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "LogSumApprox_fast_sum_of_logs" "', argument " "2"" of type '" "nupic::LogSumApprox::value_type""'");
  } 
  arg2 = static_cast< nupic::LogSumApprox::value_type >(val2);
  ecode3 = SWIG_AsVal_float(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "LogSumApprox_fast_sum_of_logs" "', argument " "3"" of type '" "nupic::LogSumApprox::value_type""'");
  } 
  arg3 = static_cast< nupic::LogSumApprox::value_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::LogSumApprox::value_type)((nupic::LogSumApprox const *)arg1)->fast_sum_of_logs(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_LogSumApprox_sum_of_logs(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::LogSumApprox *arg1 = (nupic::LogSumApprox *) 0 ;
  nupic::LogSumApprox::value_type arg2 ;
  nupic::LogSumApprox::value_type arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  float val2 ;
  int ecode2 = 0 ;
  float val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "a",(char *) "b", NULL 
  };
  nupic::LogSumApprox::value_type result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:LogSumApprox_sum_of_logs",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__LogSumApprox, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "LogSumApprox_sum_of_logs" "', argument " "1"" of type '" "nupic::LogSumApprox const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::LogSumApprox * >(argp1);
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "LogSumApprox_sum_of_logs" "', argument " "2"" of type '" "nupic::LogSumApprox::value_type""'");
  } 
  arg2 = static_cast< nupic::LogSumApprox::value_type >(val2);
  ecode3 = SWIG_AsVal_float(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "LogSumApprox_sum_of_logs" "', argument " "3"" of type '" "nupic::LogSumApprox::value_type""'");
  } 
  arg3 = static_cast< nupic::LogSumApprox::value_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::LogSumApprox::value_type)((nupic::LogSumApprox const *)arg1)->sum_of_logs(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_LogSumApprox_logSum(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::LogSumApprox *arg1 = (nupic::LogSumApprox *) 0 ;
  nupic::Real32 arg2 ;
  nupic::Real32 arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  float val2 ;
  int ecode2 = 0 ;
  float val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x",(char *) "y", NULL 
  };
  nupic::Real32 result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:LogSumApprox_logSum",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__LogSumApprox, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "LogSumApprox_logSum" "', argument " "1"" of type '" "nupic::LogSumApprox const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::LogSumApprox * >(argp1);
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "LogSumApprox_logSum" "', argument " "2"" of type '" "nupic::Real32""'");
  } 
  arg2 = static_cast< nupic::Real32 >(val2);
  ecode3 = SWIG_AsVal_float(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "LogSumApprox_logSum" "', argument " "3"" of type '" "nupic::Real32""'");
  } 
  arg3 = static_cast< nupic::Real32 >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real32)nupic_LogSumApprox_logSum((nupic::LogSumApprox 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_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_LogSumApprox_fastLogSum(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::LogSumApprox *arg1 = (nupic::LogSumApprox *) 0 ;
  nupic::Real32 arg2 ;
  nupic::Real32 arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  float val2 ;
  int ecode2 = 0 ;
  float val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x",(char *) "y", NULL 
  };
  nupic::Real32 result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:LogSumApprox_fastLogSum",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__LogSumApprox, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "LogSumApprox_fastLogSum" "', argument " "1"" of type '" "nupic::LogSumApprox const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::LogSumApprox * >(argp1);
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "LogSumApprox_fastLogSum" "', argument " "2"" of type '" "nupic::Real32""'");
  } 
  arg2 = static_cast< nupic::Real32 >(val2);
  ecode3 = SWIG_AsVal_float(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "LogSumApprox_fastLogSum" "', argument " "3"" of type '" "nupic::Real32""'");
  } 
  arg3 = static_cast< nupic::Real32 >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real32)nupic_LogSumApprox_fastLogSum((nupic::LogSumApprox 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_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_LogSumApprox(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::LogSumApprox *arg1 = (nupic::LogSumApprox *) 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__LogSumApprox, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_LogSumApprox" "', argument " "1"" of type '" "nupic::LogSumApprox *""'"); 
  }
  arg1 = reinterpret_cast< nupic::LogSumApprox * >(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 *LogSumApprox_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__LogSumApprox, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new_LogDiffApprox(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  int arg1 = (int) 5000000 ;
  nupic::LogDiffApprox::value_type arg2 = (nupic::LogDiffApprox::value_type) 1e-10 ;
  nupic::LogDiffApprox::value_type arg3 = (nupic::LogDiffApprox::value_type) 28 ;
  bool arg4 = (bool) false ;
  int val1 ;
  int ecode1 = 0 ;
  float val2 ;
  int ecode2 = 0 ;
  float val3 ;
  int ecode3 = 0 ;
  bool val4 ;
  int ecode4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "n_",(char *) "min_a_",(char *) "max_a_",(char *) "trace_", NULL 
  };
  nupic::LogDiffApprox *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOOO:new_LogDiffApprox",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  if (obj0) {
    ecode1 = SWIG_AsVal_int(obj0, &val1);
    if (!SWIG_IsOK(ecode1)) {
      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_LogDiffApprox" "', argument " "1"" of type '" "int""'");
    } 
    arg1 = static_cast< int >(val1);
  }
  if (obj1) {
    ecode2 = SWIG_AsVal_float(obj1, &val2);
    if (!SWIG_IsOK(ecode2)) {
      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_LogDiffApprox" "', argument " "2"" of type '" "nupic::LogDiffApprox::value_type""'");
    } 
    arg2 = static_cast< nupic::LogDiffApprox::value_type >(val2);
  }
  if (obj2) {
    ecode3 = SWIG_AsVal_float(obj2, &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "new_LogDiffApprox" "', argument " "3"" of type '" "nupic::LogDiffApprox::value_type""'");
    } 
    arg3 = static_cast< nupic::LogDiffApprox::value_type >(val3);
  }
  if (obj3) {
    ecode4 = SWIG_AsVal_bool(obj3, &val4);
    if (!SWIG_IsOK(ecode4)) {
      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "new_LogDiffApprox" "', 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::LogDiffApprox *)new nupic::LogDiffApprox(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__LogDiffApprox, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


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


SWIGINTERN PyObject *_wrap_LogDiffApprox_index(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::LogDiffApprox *arg1 = (nupic::LogDiffApprox *) 0 ;
  nupic::LogDiffApprox::value_type arg2 ;
  nupic::LogDiffApprox::value_type arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  float val2 ;
  int ecode2 = 0 ;
  float val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "a",(char *) "b", NULL 
  };
  int result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:LogDiffApprox_index",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__LogDiffApprox, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "LogDiffApprox_index" "', argument " "1"" of type '" "nupic::LogDiffApprox const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::LogDiffApprox * >(argp1);
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "LogDiffApprox_index" "', argument " "2"" of type '" "nupic::LogDiffApprox::value_type""'");
  } 
  arg2 = static_cast< nupic::LogDiffApprox::value_type >(val2);
  ecode3 = SWIG_AsVal_float(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "LogDiffApprox_index" "', argument " "3"" of type '" "nupic::LogDiffApprox::value_type""'");
  } 
  arg3 = static_cast< nupic::LogDiffApprox::value_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (int)((nupic::LogDiffApprox const *)arg1)->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_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_LogDiffApprox_fast_diff_of_logs(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::LogDiffApprox *arg1 = (nupic::LogDiffApprox *) 0 ;
  nupic::LogDiffApprox::value_type arg2 ;
  nupic::LogDiffApprox::value_type arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  float val2 ;
  int ecode2 = 0 ;
  float val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "a",(char *) "b", NULL 
  };
  nupic::LogDiffApprox::value_type result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:LogDiffApprox_fast_diff_of_logs",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__LogDiffApprox, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "LogDiffApprox_fast_diff_of_logs" "', argument " "1"" of type '" "nupic::LogDiffApprox const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::LogDiffApprox * >(argp1);
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "LogDiffApprox_fast_diff_of_logs" "', argument " "2"" of type '" "nupic::LogDiffApprox::value_type""'");
  } 
  arg2 = static_cast< nupic::LogDiffApprox::value_type >(val2);
  ecode3 = SWIG_AsVal_float(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "LogDiffApprox_fast_diff_of_logs" "', argument " "3"" of type '" "nupic::LogDiffApprox::value_type""'");
  } 
  arg3 = static_cast< nupic::LogDiffApprox::value_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::LogDiffApprox::value_type)((nupic::LogDiffApprox const *)arg1)->fast_diff_of_logs(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_LogDiffApprox_diff_of_logs(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::LogDiffApprox *arg1 = (nupic::LogDiffApprox *) 0 ;
  nupic::LogDiffApprox::value_type arg2 ;
  nupic::LogDiffApprox::value_type arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  float val2 ;
  int ecode2 = 0 ;
  float val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "a",(char *) "b", NULL 
  };
  nupic::LogDiffApprox::value_type result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:LogDiffApprox_diff_of_logs",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__LogDiffApprox, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "LogDiffApprox_diff_of_logs" "', argument " "1"" of type '" "nupic::LogDiffApprox const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::LogDiffApprox * >(argp1);
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "LogDiffApprox_diff_of_logs" "', argument " "2"" of type '" "nupic::LogDiffApprox::value_type""'");
  } 
  arg2 = static_cast< nupic::LogDiffApprox::value_type >(val2);
  ecode3 = SWIG_AsVal_float(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "LogDiffApprox_diff_of_logs" "', argument " "3"" of type '" "nupic::LogDiffApprox::value_type""'");
  } 
  arg3 = static_cast< nupic::LogDiffApprox::value_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::LogDiffApprox::value_type)((nupic::LogDiffApprox const *)arg1)->diff_of_logs(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_LogDiffApprox_logDiff(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::LogDiffApprox *arg1 = (nupic::LogDiffApprox *) 0 ;
  nupic::Real32 arg2 ;
  nupic::Real32 arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  float val2 ;
  int ecode2 = 0 ;
  float val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x",(char *) "y", NULL 
  };
  nupic::Real32 result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:LogDiffApprox_logDiff",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__LogDiffApprox, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "LogDiffApprox_logDiff" "', argument " "1"" of type '" "nupic::LogDiffApprox const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::LogDiffApprox * >(argp1);
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "LogDiffApprox_logDiff" "', argument " "2"" of type '" "nupic::Real32""'");
  } 
  arg2 = static_cast< nupic::Real32 >(val2);
  ecode3 = SWIG_AsVal_float(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "LogDiffApprox_logDiff" "', argument " "3"" of type '" "nupic::Real32""'");
  } 
  arg3 = static_cast< nupic::Real32 >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real32)nupic_LogDiffApprox_logDiff((nupic::LogDiffApprox 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_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_LogDiffApprox_fastLogDiff(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::LogDiffApprox *arg1 = (nupic::LogDiffApprox *) 0 ;
  nupic::Real32 arg2 ;
  nupic::Real32 arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  float val2 ;
  int ecode2 = 0 ;
  float val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x",(char *) "y", NULL 
  };
  nupic::Real32 result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:LogDiffApprox_fastLogDiff",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__LogDiffApprox, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "LogDiffApprox_fastLogDiff" "', argument " "1"" of type '" "nupic::LogDiffApprox const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::LogDiffApprox * >(argp1);
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "LogDiffApprox_fastLogDiff" "', argument " "2"" of type '" "nupic::Real32""'");
  } 
  arg2 = static_cast< nupic::Real32 >(val2);
  ecode3 = SWIG_AsVal_float(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "LogDiffApprox_fastLogDiff" "', argument " "3"" of type '" "nupic::Real32""'");
  } 
  arg3 = static_cast< nupic::Real32 >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real32)nupic_LogDiffApprox_fastLogDiff((nupic::LogDiffApprox 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_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_LogDiffApprox(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::LogDiffApprox *arg1 = (nupic::LogDiffApprox *) 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__LogDiffApprox, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_LogDiffApprox" "', argument " "1"" of type '" "nupic::LogDiffApprox *""'"); 
  }
  arg1 = reinterpret_cast< nupic::LogDiffApprox * >(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 *LogDiffApprox_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__LogDiffApprox, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new__Domain32(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::Domain< nupic::UInt32 > *arg1 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  char *  kwnames[] = {
    (char *) "o", NULL 
  };
  nupic::Domain< nupic::UInt32 > *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:new__Domain32",kwnames,&obj0)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_nupic__DomainT_unsigned_int_t,  0  | 0);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new__Domain32" "', argument " "1"" of type '" "nupic::Domain< nupic::UInt32 > const &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new__Domain32" "', argument " "1"" of type '" "nupic::Domain< nupic::UInt32 > const &""'"); 
  }
  arg1 = reinterpret_cast< nupic::Domain< nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Domain< nupic::UInt32 > *)new nupic::Domain< nupic::UInt32 >((nupic::Domain< nupic::UInt32 > 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__DomainT_unsigned_int_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__Domain32_rank(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Domain< nupic::UInt32 > *arg1 = (nupic::Domain< nupic::UInt32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  unsigned int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__DomainT_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_Domain32_rank" "', argument " "1"" of type '" "nupic::Domain< nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Domain< nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (unsigned int)((nupic::Domain< nupic::UInt32 > const *)arg1)->rank();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__Domain32_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Domain< nupic::UInt32 > *arg1 = (nupic::Domain< nupic::UInt32 > *) 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__DomainT_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_Domain32_empty" "', argument " "1"" of type '" "nupic::Domain< nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Domain< nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::Domain< nupic::UInt32 > 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__Domain32_size_elts(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Domain< nupic::UInt32 > *arg1 = (nupic::Domain< nupic::UInt32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  unsigned int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__DomainT_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_Domain32_size_elts" "', argument " "1"" of type '" "nupic::Domain< nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Domain< nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (unsigned int)((nupic::Domain< nupic::UInt32 > const *)arg1)->size_elts();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__Domain32_getNOpenDims(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Domain< nupic::UInt32 > *arg1 = (nupic::Domain< nupic::UInt32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  unsigned int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__DomainT_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_Domain32_getNOpenDims" "', argument " "1"" of type '" "nupic::Domain< nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Domain< nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (unsigned int)((nupic::Domain< nupic::UInt32 > const *)arg1)->getNOpenDims();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__Domain32_hasClosedDims(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Domain< nupic::UInt32 > *arg1 = (nupic::Domain< nupic::UInt32 > *) 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__DomainT_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_Domain32_hasClosedDims" "', argument " "1"" of type '" "nupic::Domain< nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Domain< nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::Domain< nupic::UInt32 > const *)arg1)->hasClosedDims();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__Domain32_getNClosedDims(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Domain< nupic::UInt32 > *arg1 = (nupic::Domain< nupic::UInt32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  unsigned int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__DomainT_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_Domain32_getNClosedDims" "', argument " "1"" of type '" "nupic::Domain< nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Domain< nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (unsigned int)((nupic::Domain< nupic::UInt32 > const *)arg1)->getNClosedDims();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__Domain32_includes(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::Domain< nupic::UInt32 > *arg1 = (nupic::Domain< nupic::UInt32 > *) 0 ;
  nupic::Domain< nupic::UInt32 > *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 *) "d", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_Domain32_includes",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__DomainT_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_Domain32_includes" "', argument " "1"" of type '" "nupic::Domain< nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Domain< nupic::UInt32 > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__DomainT_unsigned_int_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_Domain32_includes" "', argument " "2"" of type '" "nupic::Domain< nupic::UInt32 > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_Domain32_includes" "', argument " "2"" of type '" "nupic::Domain< nupic::UInt32 > const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::Domain< nupic::UInt32 > * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::Domain< nupic::UInt32 > const *)arg1)->includes((nupic::Domain< nupic::UInt32 > 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__Domain32(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Domain< nupic::UInt32 > *arg1 = (nupic::Domain< nupic::UInt32 > *) 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__DomainT_unsigned_int_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete__Domain32" "', argument " "1"" of type '" "nupic::Domain< nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Domain< nupic::UInt32 > * >(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 *_Domain32_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__DomainT_unsigned_int_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new__Domain2D32(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  unsigned int arg1 ;
  unsigned int arg2 ;
  unsigned int arg3 ;
  unsigned int arg4 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "first_row",(char *) "row_end",(char *) "first_col",(char *) "col_end", NULL 
  };
  nupic::Domain2D< nupic::UInt32 > *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:new__Domain2D32",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  ecode1 = SWIG_AsVal_unsigned_SS_int(obj0, &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new__Domain2D32" "', argument " "1"" of type '" "unsigned int""'");
  } 
  arg1 = static_cast< unsigned int >(val1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new__Domain2D32" "', argument " "2"" of type '" "unsigned int""'");
  } 
  arg2 = static_cast< unsigned int >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "new__Domain2D32" "', argument " "3"" of type '" "unsigned int""'");
  } 
  arg3 = static_cast< unsigned int >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "new__Domain2D32" "', argument " "4"" of type '" "unsigned int""'");
  } 
  arg4 = static_cast< unsigned int >(val4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Domain2D< nupic::UInt32 > *)new nupic::Domain2D< nupic::UInt32 >(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__Domain2DT_unsigned_int_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__Domain2D32_getFirstRow(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Domain2D< nupic::UInt32 > *arg1 = (nupic::Domain2D< nupic::UInt32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  unsigned int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__Domain2DT_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_Domain2D32_getFirstRow" "', argument " "1"" of type '" "nupic::Domain2D< nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Domain2D< nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (unsigned int)((nupic::Domain2D< nupic::UInt32 > const *)arg1)->getFirstRow();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__Domain2D32_getRowEnd(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Domain2D< nupic::UInt32 > *arg1 = (nupic::Domain2D< nupic::UInt32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  unsigned int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__Domain2DT_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_Domain2D32_getRowEnd" "', argument " "1"" of type '" "nupic::Domain2D< nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Domain2D< nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (unsigned int)((nupic::Domain2D< nupic::UInt32 > const *)arg1)->getRowEnd();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__Domain2D32_getFirstCol(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Domain2D< nupic::UInt32 > *arg1 = (nupic::Domain2D< nupic::UInt32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  unsigned int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__Domain2DT_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_Domain2D32_getFirstCol" "', argument " "1"" of type '" "nupic::Domain2D< nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Domain2D< nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (unsigned int)((nupic::Domain2D< nupic::UInt32 > const *)arg1)->getFirstCol();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__Domain2D32_getColEnd(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Domain2D< nupic::UInt32 > *arg1 = (nupic::Domain2D< nupic::UInt32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  unsigned int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__Domain2DT_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_Domain2D32_getColEnd" "', argument " "1"" of type '" "nupic::Domain2D< nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Domain2D< nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (unsigned int)((nupic::Domain2D< nupic::UInt32 > const *)arg1)->getColEnd();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__Domain2D32(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Domain2D< nupic::UInt32 > *arg1 = (nupic::Domain2D< nupic::UInt32 > *) 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__Domain2DT_unsigned_int_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete__Domain2D32" "', argument " "1"" of type '" "nupic::Domain2D< nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Domain2D< nupic::UInt32 > * >(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 *_Domain2D32_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__Domain2DT_unsigned_int_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap__DistanceToZero32___call__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::DistanceToZero< nupic::Real32 > *arg1 = (nupic::DistanceToZero< nupic::Real32 > *) 0 ;
  float *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  float temp2 ;
  float val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  float result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_DistanceToZero32___call__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__DistanceToZeroT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_DistanceToZero32___call__" "', argument " "1"" of type '" "nupic::DistanceToZero< nupic::Real32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::DistanceToZero< nupic::Real32 > * >(argp1);
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_DistanceToZero32___call__" "', argument " "2"" of type '" "float""'");
  } 
  temp2 = static_cast< float >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (float)((nupic::DistanceToZero< nupic::Real32 > const *)arg1)->operator ()((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_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


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


SWIGINTERN PyObject *_wrap_delete__DistanceToZero32(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::DistanceToZero< nupic::Real32 > *arg1 = (nupic::DistanceToZero< nupic::Real32 > *) 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__DistanceToZeroT_float_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete__DistanceToZero32" "', argument " "1"" of type '" "nupic::DistanceToZero< nupic::Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::DistanceToZero< nupic::Real32 > * >(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 *_DistanceToZero32_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__DistanceToZeroT_float_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new__SparseMatrix32__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *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::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *)new nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new__SparseMatrix32__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg1 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  ecode1 = SWIG_AsVal_unsigned_SS_int(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new__SparseMatrix32" "', argument " "1"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg1 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new__SparseMatrix32" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *)new nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >(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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new__SparseMatrix32__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::istream *arg1 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *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__SparseMatrix32" "', argument " "1"" of type '" "std::istream &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new__SparseMatrix32" "', 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::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *)new nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >(*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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new__SparseMatrix32__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0  | 0);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new__SparseMatrix32" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new__SparseMatrix32" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *)new nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new__SparseMatrix32(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new__SparseMatrix32",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;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__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:
    
    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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_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_unsigned_SS_int(argv[0], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_4;
      _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_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__SparseMatrix32__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new__SparseMatrix32__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_new__SparseMatrix32__SWIG_3(self, argc, argv);
    case 4:
      return _wrap_new__SparseMatrix32__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new__SparseMatrix32'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::SparseMatrix()\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::SparseMatrix(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type)\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::SparseMatrix(std::istream &)\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::SparseMatrix(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_initializeWithFixedNNZR(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type arg3 = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type) 1 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg4 = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg5 = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type) 42 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  float val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  unsigned int val5 ;
  int ecode5 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "nnzr",(char *) "v",(char *) "mode",(char *) "seed", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|OOO:_SparseMatrix32_initializeWithFixedNNZR",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_initializeWithFixedNNZR" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_initializeWithFixedNNZR" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  if (obj2) {
    ecode3 = SWIG_AsVal_float(obj2, &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_initializeWithFixedNNZR" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
    } 
    arg3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val3);
  }
  if (obj3) {
    ecode4 = SWIG_AsVal_unsigned_SS_int(obj3, &val4);
    if (!SWIG_IsOK(ecode4)) {
      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_initializeWithFixedNNZR" "', argument " "4"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
    } 
    arg4 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val4);
  }
  if (obj4) {
    ecode5 = SWIG_AsVal_unsigned_SS_int(obj4, &val5);
    if (!SWIG_IsOK(ecode5)) {
      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "_SparseMatrix32_initializeWithFixedNNZR" "', argument " "5"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
    } 
    arg5 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val5);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->initializeWithFixedNNZR(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_delete__SparseMatrix32(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete__SparseMatrix32" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(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__SparseMatrix32_isZero(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_isZero" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->isZero();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__SparseMatrix32_getIsNearlyZeroFunction(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::IsNearlyZero< nupic::DistanceToZero< nupic::Real32 > > *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_getIsNearlyZeroFunction" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::IsNearlyZero< nupic::DistanceToZero< nupic::Real32 > > *) &((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->getIsNearlyZeroFunction();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__IsNearlyZeroT_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_isCompact(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_isCompact" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->isCompact();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__SparseMatrix32_nRows(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_nRows" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->nRows();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__SparseMatrix32_nCols(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_nCols" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->nCols();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__SparseMatrix32_nBytes(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_nBytes" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->nBytes();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__SparseMatrix32_nNonZerosOnRow(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row", NULL 
  };
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_nNonZerosOnRow",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_nNonZerosOnRow" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_nNonZerosOnRow" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->nNonZerosOnRow(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__SparseMatrix32_nNonZerosOnCol(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "col", NULL 
  };
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_nNonZerosOnCol",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_nNonZerosOnCol" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_nNonZerosOnCol" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->nNonZerosOnCol(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__SparseMatrix32_nNonZeros(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_nNonZeros" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->nNonZeros();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__SparseMatrix32_isRowZero(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_isRowZero",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_isRowZero" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_isRowZero" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->isRowZero(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__SparseMatrix32_isColZero(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "col", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_isColZero",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_isColZero" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_isColZero" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->isColZero(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__SparseMatrix32_nNonZeroRows(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_nNonZeroRows" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->nNonZeroRows();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__SparseMatrix32_nNonZeroCols(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_nNonZeroCols" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->nNonZeroCols();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__SparseMatrix32_nZeroRows(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_nZeroRows" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->nZeroRows();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__SparseMatrix32_nZeroCols(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_nZeroCols" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->nZeroCols();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__SparseMatrix32_firstNonZeroOnRow(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row", NULL 
  };
  std::pair< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_firstNonZeroOnRow",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_firstNonZeroOnRow" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_firstNonZeroOnRow" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->firstNonZeroOnRow(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::pair<unsigned int,float > >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_lastNonZeroOnRow(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row", NULL 
  };
  std::pair< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_lastNonZeroOnRow",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_lastNonZeroOnRow" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_lastNonZeroOnRow" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->lastNonZeroOnRow(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::pair<unsigned int,float > >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_rowBandwidth(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row", NULL 
  };
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_rowBandwidth",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rowBandwidth" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_rowBandwidth" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->rowBandwidth(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__SparseMatrix32_firstNonZeroOnCol(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "col", NULL 
  };
  std::pair< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_firstNonZeroOnCol",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_firstNonZeroOnCol" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_firstNonZeroOnCol" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->firstNonZeroOnCol(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::pair<unsigned int,float > >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_lastNonZeroOnCol(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "col", NULL 
  };
  std::pair< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_lastNonZeroOnCol",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_lastNonZeroOnCol" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_lastNonZeroOnCol" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->lastNonZeroOnCol(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::pair<unsigned int,float > >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_colBandwidth(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "col", NULL 
  };
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_colBandwidth",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_colBandwidth" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_colBandwidth" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->colBandwidth(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__SparseMatrix32_nonZerosInRowRange(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg3 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row",(char *) "col_begin",(char *) "col_end", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:_SparseMatrix32_nonZerosInRowRange",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_nonZerosInRowRange" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_nonZerosInRowRange" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_nonZerosInRowRange" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_nonZerosInRowRange" "', argument " "4"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg4 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->nonZerosInRowRange(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__SparseMatrix32_nNonZerosInRowRange(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg3 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row",(char *) "col_begin",(char *) "col_end", NULL 
  };
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:_SparseMatrix32_nNonZerosInRowRange",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_nNonZerosInRowRange" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_nNonZerosInRowRange" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_nNonZerosInRowRange" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_nNonZerosInRowRange" "', argument " "4"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg4 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->nNonZerosInRowRange(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__SparseMatrix32_nNonZerosInBox(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg3 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg4 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg5 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  unsigned int val5 ;
  int ecode5 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row_begin",(char *) "row_end",(char *) "col_begin",(char *) "col_end", NULL 
  };
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOO:_SparseMatrix32_nNonZerosInBox",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_nNonZerosInBox" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_nNonZerosInBox" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_nNonZerosInBox" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_nNonZerosInBox" "', argument " "4"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg4 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val4);
  ecode5 = SWIG_AsVal_unsigned_SS_int(obj4, &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "_SparseMatrix32_nNonZerosInBox" "', argument " "5"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg5 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val5);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->nNonZerosInBox(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_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_isSymmetric(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_isSymmetric" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->isSymmetric();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__SparseMatrix32_isBinary(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_isBinary" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->isBinary();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__SparseMatrix32_equals(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *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 *) "B", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_equals",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_equals" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SparseMatrix32_equals" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_equals" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->equals((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > 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__SparseMatrix32_sameRowNonZeroIndices(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned 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 *) "row",(char *) "B", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SparseMatrix32_sameRowNonZeroIndices",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_sameRowNonZeroIndices" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_sameRowNonZeroIndices" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0  | 0);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "_SparseMatrix32_sameRowNonZeroIndices" "', argument " "3"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_sameRowNonZeroIndices" "', argument " "3"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  arg3 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->sameRowNonZeroIndices(arg2,(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > 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__SparseMatrix32_sameNonZeroIndices(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *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 *) "B", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_sameNonZeroIndices",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_sameNonZeroIndices" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SparseMatrix32_sameNonZeroIndices" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_sameNonZeroIndices" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->sameNonZeroIndices((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > 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__SparseMatrix32_nonZeroIndicesIncluded__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  bool result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_nonZeroIndicesIncluded" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_nonZeroIndicesIncluded" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0  | 0);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "_SparseMatrix32_nonZeroIndicesIncluded" "', argument " "3"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_nonZeroIndicesIncluded" "', argument " "3"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  arg3 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->nonZeroIndicesIncluded(arg2,(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > 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__SparseMatrix32_nonZeroIndicesIncluded__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  bool result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_nonZeroIndicesIncluded" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SparseMatrix32_nonZeroIndicesIncluded" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_nonZeroIndicesIncluded" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->nonZeroIndicesIncluded((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > 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__SparseMatrix32_nonZeroIndicesIncluded(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SparseMatrix32_nonZeroIndicesIncluded",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_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_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 == 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 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;
      {
        int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_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__SparseMatrix32_nonZeroIndicesIncluded__SWIG_1(self, argc, argv);
    case 2:
      return _wrap__SparseMatrix32_nonZeroIndicesIncluded__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SparseMatrix32_nonZeroIndicesIncluded'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::nonZeroIndicesIncluded(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &) const\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::nonZeroIndicesIncluded(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &) const\n");
  return 0;
}


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


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


SWIGINTERN PyObject *_wrap__SparseMatrix32_CSRSize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_CSRSize" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->CSRSize();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__SparseMatrix32_fromCSR(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  std::istream *arg2 = 0 ;
  bool arg3 = (bool) false ;
  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 *) "inStreamParam",(char *) "zero_permissive", NULL 
  };
  std::istream *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|O:_SparseMatrix32_fromCSR",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_fromCSR" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__istream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SparseMatrix32_fromCSR" "', argument " "2"" of type '" "std::istream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_fromCSR" "', argument " "2"" of type '" "std::istream &""'"); 
  }
  arg2 = reinterpret_cast< std::istream * >(argp2);
  if (obj2) {
    ecode3 = SWIG_AsVal_bool(obj2, &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_fromCSR" "', 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 = (std::istream *) &(arg1)->fromCSR(*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_std__istream, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_toCSR(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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 *) "out", NULL 
  };
  std::ostream *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_toCSR",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_toCSR" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__ostream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SparseMatrix32_toCSR" "', argument " "2"" of type '" "std::ostream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_toCSR" "', 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
    {
      result = (std::ostream *) &((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->toCSR(*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__ostream, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_write__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  SparseMatrixProto::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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_write" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_SparseMatrixProto__Builder,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SparseMatrix32_write" "', argument " "2"" of type '" "SparseMatrixProto::Builder &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_write" "', argument " "2"" of type '" "SparseMatrixProto::Builder &""'"); 
  }
  arg2 = reinterpret_cast< SparseMatrixProto::Builder * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > 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__SparseMatrix32_read__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  SparseMatrixProto::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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_read" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_SparseMatrixProto__Reader,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SparseMatrix32_read" "', argument " "2"" of type '" "SparseMatrixProto::Reader &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_read" "', argument " "2"" of type '" "SparseMatrixProto::Reader &""'"); 
  }
  arg2 = reinterpret_cast< SparseMatrixProto::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__SparseMatrix32_fromBinary(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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:_SparseMatrix32_fromBinary",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_fromBinary" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__istream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SparseMatrix32_fromBinary" "', argument " "2"" of type '" "std::istream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_fromBinary" "', 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)->fromBinary(*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__SparseMatrix32_toBinary(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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:_SparseMatrix32_toBinary",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_toBinary" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__ostream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SparseMatrix32_toBinary" "', argument " "2"" of type '" "std::ostream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_toBinary" "', 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
    {
      (arg1)->toBinary(*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__SparseMatrix32_resize(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg3 ;
  bool arg4 = (bool) false ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int 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 *) "new_nrows",(char *) "new_ncols",(char *) "setToZero", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:_SparseMatrix32_resize",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_resize" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_resize" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_resize" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val3);
  if (obj3) {
    ecode4 = SWIG_AsVal_bool(obj3, &val4);
    if (!SWIG_IsOK(ecode4)) {
      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_resize" "', 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)->resize(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__SparseMatrix32_reshape(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "new_nrows",(char *) "new_ncols", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SparseMatrix32_reshape",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_reshape" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_reshape" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_reshape" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->reshape(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__SparseMatrix32_deleteRow(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "del_row", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_deleteRow",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_deleteRow" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_deleteRow" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->deleteRow(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__SparseMatrix32_deleteCol(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "del_col", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_deleteCol",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_deleteCol" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_deleteCol" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->deleteCol(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__SparseMatrix32_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::self_type *arg2 = 0 ;
  bool arg3 = (bool) false ;
  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 *) "other",(char *) "zero_permissive", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|O:_SparseMatrix32_append",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_append" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SparseMatrix32_append" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::self_type const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_append" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::self_type const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::self_type * >(argp2);
  if (obj2) {
    ecode3 = SWIG_AsVal_bool(obj2, &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_append" "', 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)->append((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::self_type 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__SparseMatrix32_duplicateRow(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_duplicateRow",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_duplicateRow" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_duplicateRow" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->duplicateRow(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__SparseMatrix32_setZero(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg3 ;
  bool arg4 = (bool) false ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int 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 *) "row",(char *) "col",(char *) "resizeYesNo", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:_SparseMatrix32_setZero",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_setZero" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_setZero" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_setZero" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val3);
  if (obj3) {
    ecode4 = SWIG_AsVal_bool(obj3, &val4);
    if (!SWIG_IsOK(ecode4)) {
      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_setZero" "', 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)->setZero(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__SparseMatrix32_setDiagonalToZero(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_setDiagonalToZero" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setDiagonalToZero();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_setDiagonalToVal(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp2 ;
  float val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "val", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_setDiagonalToVal",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_setDiagonalToVal" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_setDiagonalToVal" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  temp2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setDiagonalToVal((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::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__SparseMatrix32_setNonZero(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg3 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg4 = 0 ;
  bool arg5 = (bool) false ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp4 ;
  float 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 *) "i",(char *) "j",(char *) "val",(char *) "resizeYesNo", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO|O:_SparseMatrix32_setNonZero",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_setNonZero" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_setNonZero" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_setNonZero" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val3);
  ecode4 = SWIG_AsVal_float(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_setNonZero" "', argument " "4"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  temp4 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val4);
  arg4 = &temp4;
  if (obj4) {
    ecode5 = SWIG_AsVal_bool(obj4, &val5);
    if (!SWIG_IsOK(ecode5)) {
      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "_SparseMatrix32_setNonZero" "', 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)->setNonZero(arg2,arg3,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type const &)*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__SparseMatrix32_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg3 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg4 = 0 ;
  bool arg5 = (bool) false ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp4 ;
  float 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 *) "i",(char *) "j",(char *) "val",(char *) "resizeYesNo", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO|O:_SparseMatrix32_set",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_set" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_set" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_set" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val3);
  ecode4 = SWIG_AsVal_float(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_set" "', argument " "4"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  temp4 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val4);
  arg4 = &temp4;
  if (obj4) {
    ecode5 = SWIG_AsVal_bool(obj4, &val5);
    if (!SWIG_IsOK(ecode5)) {
      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "_SparseMatrix32_set" "', 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)->set(arg2,arg3,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type const &)*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__SparseMatrix32_setBoxToZero(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg3 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg4 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg5 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  unsigned int val5 ;
  int ecode5 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row_begin",(char *) "row_end",(char *) "col_begin",(char *) "col_end", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOO:_SparseMatrix32_setBoxToZero",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_setBoxToZero" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_setBoxToZero" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_setBoxToZero" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_setBoxToZero" "', argument " "4"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg4 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val4);
  ecode5 = SWIG_AsVal_unsigned_SS_int(obj4, &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "_SparseMatrix32_setBoxToZero" "', argument " "5"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg5 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val5);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setBoxToZero(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__SparseMatrix32_setBox(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg3 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg4 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg5 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg6 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  unsigned int val5 ;
  int ecode5 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp6 ;
  float 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 *) "row_begin",(char *) "row_end",(char *) "col_begin",(char *) "col_end",(char *) "val", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOOO:_SparseMatrix32_setBox",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_setBox" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_setBox" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_setBox" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_setBox" "', argument " "4"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg4 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val4);
  ecode5 = SWIG_AsVal_unsigned_SS_int(obj4, &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "_SparseMatrix32_setBox" "', argument " "5"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg5 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val5);
  ecode6 = SWIG_AsVal_float(obj5, &val6);
  if (!SWIG_IsOK(ecode6)) {
    SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "_SparseMatrix32_setBox" "', argument " "6"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  temp6 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val6);
  arg6 = &temp6;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setBox(arg2,arg3,arg4,arg5,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type const &)*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__SparseMatrix32_increment(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg3 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type arg4 = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type) 1 ;
  bool arg5 = (bool) false ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  float 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 *) "i",(char *) "j",(char *) "delta",(char *) "resizeYesNo", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|OO:_SparseMatrix32_increment",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_increment" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_increment" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_increment" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val3);
  if (obj3) {
    ecode4 = SWIG_AsVal_float(obj3, &val4);
    if (!SWIG_IsOK(ecode4)) {
      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_increment" "', argument " "4"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
    } 
    arg4 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val4);
  }
  if (obj4) {
    ecode5 = SWIG_AsVal_bool(obj4, &val5);
    if (!SWIG_IsOK(ecode5)) {
      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "_SparseMatrix32_increment" "', 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)->increment(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__SparseMatrix32_incrementWNZ(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg3 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type arg4 = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type) 1 ;
  bool arg5 = (bool) false ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  float 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 *) "i",(char *) "j",(char *) "delta",(char *) "resizeYesNo", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|OO:_SparseMatrix32_incrementWNZ",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_incrementWNZ" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_incrementWNZ" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_incrementWNZ" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val3);
  if (obj3) {
    ecode4 = SWIG_AsVal_float(obj3, &val4);
    if (!SWIG_IsOK(ecode4)) {
      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_incrementWNZ" "', argument " "4"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
    } 
    arg4 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val4);
  }
  if (obj4) {
    ecode5 = SWIG_AsVal_bool(obj4, &val5);
    if (!SWIG_IsOK(ecode5)) {
      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "_SparseMatrix32_incrementWNZ" "', 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)->incrementWNZ(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__SparseMatrix32_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row",(char *) "col", NULL 
  };
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SparseMatrix32_get",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_get" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_get" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_get" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->get(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__SparseMatrix32_row_nz_index_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row", NULL 
  };
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::const_row_nz_index_iterator result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_row_nz_index_begin",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_row_nz_index_begin" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_row_nz_index_begin" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::const_row_nz_index_iterator)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->row_nz_index_begin(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_unsigned_int, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_row_nz_index_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row", NULL 
  };
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::const_row_nz_index_iterator result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_row_nz_index_end",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_row_nz_index_end" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_row_nz_index_end" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::const_row_nz_index_iterator)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->row_nz_index_end(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_unsigned_int, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_row_nz_value_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row", NULL 
  };
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::const_row_nz_value_iterator result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_row_nz_value_begin",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_row_nz_value_begin" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_row_nz_value_begin" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::const_row_nz_value_iterator)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->row_nz_value_begin(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_float, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_row_nz_value_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row", NULL 
  };
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::const_row_nz_value_iterator result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_row_nz_value_end",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_row_nz_value_end" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_row_nz_value_end" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::const_row_nz_value_iterator)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->row_nz_value_end(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_float, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_getSlice2__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg3 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg4 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg5 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg6 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  unsigned int val5 ;
  int ecode5 = 0 ;
  void *argp6 = 0 ;
  int res6 = 0 ;
  
  if ((nobjs < 6) || (nobjs > 6)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_getSlice2" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_getSlice2" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_getSlice2" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_getSlice2" "', argument " "4"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg4 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val4);
  ecode5 = SWIG_AsVal_unsigned_SS_int(swig_obj[4], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "_SparseMatrix32_getSlice2" "', argument " "5"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg5 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val5);
  res6 = SWIG_ConvertPtr(swig_obj[5], &argp6, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0 );
  if (!SWIG_IsOK(res6)) {
    SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "_SparseMatrix32_getSlice2" "', argument " "6"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  if (!argp6) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_getSlice2" "', argument " "6"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  arg6 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp6);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->getSlice2(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__SparseMatrix32_setRowToZero(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_setRowToZero",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_setRowToZero" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_setRowToZero" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setRowToZero(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__SparseMatrix32_setRowToVal(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  float val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row",(char *) "val", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SparseMatrix32_setRowToVal",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_setRowToVal" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_setRowToVal" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_float(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_setRowToVal" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  arg3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setRowToVal(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__SparseMatrix32_setColToZero(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "col", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_setColToZero",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_setColToZero" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_setColToZero" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setColToZero(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__SparseMatrix32_setColToVal(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  float val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "col",(char *) "val", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SparseMatrix32_setColToVal",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_setColToVal" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_setColToVal" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_float(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_setColToVal" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  arg3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setColToVal(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__SparseMatrix32_setToZero(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_setToZero" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setToZero();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_setFromOuter(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > *arg2 = 0 ;
  std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > *arg3 = 0 ;
  bool arg4 = (bool) false ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  int res3 = SWIG_OLDOBJ ;
  bool val4 ;
  int ecode4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x",(char *) "y",(char *) "keepMemory", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:_SparseMatrix32_setFromOuter",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_setFromOuter" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    std::vector<float,std::allocator< float > > *ptr = (std::vector<float,std::allocator< float > > *)0;
    res2 = swig::asptr(obj1, &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SparseMatrix32_setFromOuter" "', argument " "2"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_setFromOuter" "', argument " "2"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &""'"); 
    }
    arg2 = ptr;
  }
  {
    std::vector<float,std::allocator< float > > *ptr = (std::vector<float,std::allocator< float > > *)0;
    res3 = swig::asptr(obj2, &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "_SparseMatrix32_setFromOuter" "', argument " "3"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_setFromOuter" "', argument " "3"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &""'"); 
    }
    arg3 = ptr;
  }
  if (obj3) {
    ecode4 = SWIG_AsVal_bool(obj3, &val4);
    if (!SWIG_IsOK(ecode4)) {
      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_setFromOuter" "', 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)->setFromOuter((std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &)*arg2,(std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > 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_Py_Void();
  if (SWIG_IsNewObj(res2)) delete arg2;
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_setFromElementMultiplyWithOuter(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > *arg2 = 0 ;
  std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > *arg3 = 0 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  int res3 = SWIG_OLDOBJ ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x",(char *) "y",(char *) "b", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:_SparseMatrix32_setFromElementMultiplyWithOuter",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_setFromElementMultiplyWithOuter" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    std::vector<float,std::allocator< float > > *ptr = (std::vector<float,std::allocator< float > > *)0;
    res2 = swig::asptr(obj1, &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SparseMatrix32_setFromElementMultiplyWithOuter" "', argument " "2"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_setFromElementMultiplyWithOuter" "', argument " "2"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &""'"); 
    }
    arg2 = ptr;
  }
  {
    std::vector<float,std::allocator< float > > *ptr = (std::vector<float,std::allocator< float > > *)0;
    res3 = swig::asptr(obj2, &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "_SparseMatrix32_setFromElementMultiplyWithOuter" "', argument " "3"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_setFromElementMultiplyWithOuter" "', argument " "3"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &""'"); 
    }
    arg3 = ptr;
  }
  res4 = SWIG_ConvertPtr(obj3, &argp4, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0  | 0);
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "_SparseMatrix32_setFromElementMultiplyWithOuter" "', argument " "4"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  if (!argp4) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_setFromElementMultiplyWithOuter" "', argument " "4"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  arg4 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setFromElementMultiplyWithOuter((std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &)*arg2,(std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &)*arg3,(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > 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(res2)) delete arg2;
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_setRowFromDense(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SparseMatrix32_setRowFromDense",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_setRowFromDense" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_setRowFromDense" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    std::vector<float,std::allocator< float > > *ptr = (std::vector<float,std::allocator< float > > *)0;
    res3 = swig::asptr(obj2, &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "_SparseMatrix32_setRowFromDense" "', argument " "3"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_setRowFromDense" "', argument " "3"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setRowFromDense(arg2,(std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::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();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_getRowToDense(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned 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 *) "row",(char *) "dense", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SparseMatrix32_getRowToDense",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_getRowToDense" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_getRowToDense" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  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 '" "_SparseMatrix32_getRowToDense" "', argument " "3"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_getRowToDense" "', argument " "3"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > &""'"); 
  }
  arg3 = reinterpret_cast< std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->getRowToDense(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__SparseMatrix32_copyRow(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg3 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "dst_row",(char *) "src_row",(char *) "other", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:_SparseMatrix32_copyRow",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_copyRow" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_copyRow" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_copyRow" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val3);
  res4 = SWIG_ConvertPtr(obj3, &argp4, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "_SparseMatrix32_copyRow" "', argument " "4"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  if (!argp4) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_copyRow" "', argument " "4"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  arg4 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->copyRow(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__SparseMatrix32_getColToDense(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned 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 *) "col",(char *) "dense", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SparseMatrix32_getColToDense",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_getColToDense" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_getColToDense" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  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 '" "_SparseMatrix32_getColToDense" "', argument " "3"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_getColToDense" "', argument " "3"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > &""'"); 
  }
  arg3 = reinterpret_cast< std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->getColToDense(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__SparseMatrix32_setColFromDense(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "col",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SparseMatrix32_setColFromDense",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_setColFromDense" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_setColFromDense" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    std::vector<float,std::allocator< float > > *ptr = (std::vector<float,std::allocator< float > > *)0;
    res3 = swig::asptr(obj2, &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "_SparseMatrix32_setColFromDense" "', argument " "3"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_setColFromDense" "', argument " "3"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setColFromDense(arg2,(std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::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();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_shiftRows(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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:_SparseMatrix32_shiftRows",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_shiftRows" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_shiftRows" "', 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)->shiftRows(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__SparseMatrix32_shiftCols(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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:_SparseMatrix32_shiftCols",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_shiftCols" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_shiftCols" "', 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)->shiftCols(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__SparseMatrix32_transpose__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_transpose" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SparseMatrix32_transpose" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_transpose" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->transpose(*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__SparseMatrix32_transpose__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_transpose" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->transpose();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_transpose(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SparseMatrix32_transpose",0,2,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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_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__SparseMatrix32_transpose__SWIG_1(self, argc, argv);
    case 2:
      return _wrap__SparseMatrix32_transpose__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SparseMatrix32_transpose'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::transpose(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &) const\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::transpose()\n");
  return 0;
}


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


SWIGINTERN PyObject *_wrap__SparseMatrix32_addToTranspose(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SparseMatrix32_addToTranspose",0,2,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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_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__SparseMatrix32_addToTranspose__SWIG_1(self, argc, argv);
    case 2:
      return _wrap__SparseMatrix32_addToTranspose__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SparseMatrix32_addToTranspose'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::addToTranspose(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &) const\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::addToTranspose()\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_thresholdRow(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type arg3_defvalue = nupic::Epsilon ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg3 = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *) &arg3_defvalue ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp3 ;
  float val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row",(char *) "threshold", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|O:_SparseMatrix32_thresholdRow",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_thresholdRow" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_thresholdRow" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  if (obj2) {
    ecode3 = SWIG_AsVal_float(obj2, &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_thresholdRow" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
    } 
    temp3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val3);
    arg3 = &temp3;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->thresholdRow(arg2,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::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__SparseMatrix32_thresholdCol(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type arg3_defvalue = nupic::Epsilon ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg3 = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *) &arg3_defvalue ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp3 ;
  float val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "col",(char *) "threshold", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|O:_SparseMatrix32_thresholdCol",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_thresholdCol" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_thresholdCol" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  if (obj2) {
    ecode3 = SWIG_AsVal_float(obj2, &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_thresholdCol" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
    } 
    temp3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val3);
    arg3 = &temp3;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->thresholdCol(arg2,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::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__SparseMatrix32_threshold__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type arg2_defvalue = nupic::Epsilon ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg2 = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *) &arg2_defvalue ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp2 ;
  float val2 ;
  int ecode2 = 0 ;
  
  if ((nobjs < 1) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_threshold" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  if (swig_obj[1]) {
    ecode2 = SWIG_AsVal_float(swig_obj[1], &val2);
    if (!SWIG_IsOK(ecode2)) {
      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_threshold" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
    } 
    temp2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val2);
    arg2 = &temp2;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->threshold((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::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__SparseMatrix32_clipRow(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type arg3 ;
  bool arg4 = (bool) true ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  float 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 *) "row",(char *) "val",(char *) "above", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:_SparseMatrix32_clipRow",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_clipRow" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_clipRow" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_float(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_clipRow" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  arg3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val3);
  if (obj3) {
    ecode4 = SWIG_AsVal_bool(obj3, &val4);
    if (!SWIG_IsOK(ecode4)) {
      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_clipRow" "', 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)->clipRow(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__SparseMatrix32_clipRowAboveAndBelow(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type arg3 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  float val3 ;
  int ecode3 = 0 ;
  float val4 ;
  int ecode4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row",(char *) "a",(char *) "b", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:_SparseMatrix32_clipRowAboveAndBelow",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_clipRowAboveAndBelow" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_clipRowAboveAndBelow" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_float(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_clipRowAboveAndBelow" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  arg3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val3);
  ecode4 = SWIG_AsVal_float(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_clipRowAboveAndBelow" "', argument " "4"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  arg4 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->clipRowAboveAndBelow(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__SparseMatrix32_clipCol(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type arg3 ;
  bool arg4 = (bool) true ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  float 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 *) "col",(char *) "val",(char *) "above", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:_SparseMatrix32_clipCol",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_clipCol" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_clipCol" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_float(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_clipCol" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  arg3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val3);
  if (obj3) {
    ecode4 = SWIG_AsVal_bool(obj3, &val4);
    if (!SWIG_IsOK(ecode4)) {
      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_clipCol" "', 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)->clipCol(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__SparseMatrix32_clipColAboveAndBelow(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type arg3 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  float val3 ;
  int ecode3 = 0 ;
  float val4 ;
  int ecode4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "col",(char *) "a",(char *) "b", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:_SparseMatrix32_clipColAboveAndBelow",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_clipColAboveAndBelow" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_clipColAboveAndBelow" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_float(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_clipColAboveAndBelow" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  arg3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val3);
  ecode4 = SWIG_AsVal_float(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_clipColAboveAndBelow" "', argument " "4"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  arg4 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->clipColAboveAndBelow(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__SparseMatrix32_clip(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type arg2 ;
  bool arg3 = (bool) true ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  float val2 ;
  int ecode2 = 0 ;
  bool val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "val",(char *) "above", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|O:_SparseMatrix32_clip",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_clip" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_clip" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val2);
  if (obj2) {
    ecode3 = SWIG_AsVal_bool(obj2, &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_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__SparseMatrix32_clipAboveAndBelow(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  float val2 ;
  int ecode2 = 0 ;
  float val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "a",(char *) "b", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SparseMatrix32_clipAboveAndBelow",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_clipAboveAndBelow" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_clipAboveAndBelow" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val2);
  ecode3 = SWIG_AsVal_float(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_clipAboveAndBelow" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  arg3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->clipAboveAndBelow(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__SparseMatrix32_countWhereEqual(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg3 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg4 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg5 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg6 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  unsigned int val5 ;
  int ecode5 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp6 ;
  float 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 *) "begin_row",(char *) "end_row",(char *) "begin_col",(char *) "end_col",(char *) "value", NULL 
  };
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOOO:_SparseMatrix32_countWhereEqual",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_countWhereEqual" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_countWhereEqual" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_countWhereEqual" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_countWhereEqual" "', argument " "4"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg4 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val4);
  ecode5 = SWIG_AsVal_unsigned_SS_int(obj4, &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "_SparseMatrix32_countWhereEqual" "', argument " "5"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg5 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val5);
  ecode6 = SWIG_AsVal_float(obj5, &val6);
  if (!SWIG_IsOK(ecode6)) {
    SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "_SparseMatrix32_countWhereEqual" "', argument " "6"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  temp6 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val6);
  arg6 = &temp6;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->countWhereEqual(arg2,arg3,arg4,arg5,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type const &)*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__SparseMatrix32_countWhereGreater(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg3 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg4 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg5 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg6 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  unsigned int val5 ;
  int ecode5 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp6 ;
  float 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 *) "begin_row",(char *) "end_row",(char *) "begin_col",(char *) "end_col",(char *) "value", NULL 
  };
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOOO:_SparseMatrix32_countWhereGreater",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_countWhereGreater" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_countWhereGreater" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_countWhereGreater" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_countWhereGreater" "', argument " "4"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg4 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val4);
  ecode5 = SWIG_AsVal_unsigned_SS_int(obj4, &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "_SparseMatrix32_countWhereGreater" "', argument " "5"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg5 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val5);
  ecode6 = SWIG_AsVal_float(obj5, &val6);
  if (!SWIG_IsOK(ecode6)) {
    SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "_SparseMatrix32_countWhereGreater" "', argument " "6"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  temp6 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val6);
  arg6 = &temp6;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->countWhereGreater(arg2,arg3,arg4,arg5,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type const &)*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__SparseMatrix32_countWhereGreaterEqual(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg3 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg4 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg5 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg6 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  unsigned int val5 ;
  int ecode5 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp6 ;
  float 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 *) "begin_row",(char *) "end_row",(char *) "begin_col",(char *) "end_col",(char *) "value", NULL 
  };
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOOO:_SparseMatrix32_countWhereGreaterEqual",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_countWhereGreaterEqual" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_countWhereGreaterEqual" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_countWhereGreaterEqual" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_countWhereGreaterEqual" "', argument " "4"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg4 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val4);
  ecode5 = SWIG_AsVal_unsigned_SS_int(obj4, &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "_SparseMatrix32_countWhereGreaterEqual" "', argument " "5"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg5 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val5);
  ecode6 = SWIG_AsVal_float(obj5, &val6);
  if (!SWIG_IsOK(ecode6)) {
    SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "_SparseMatrix32_countWhereGreaterEqual" "', argument " "6"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  temp6 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val6);
  arg6 = &temp6;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->countWhereGreaterEqual(arg2,arg3,arg4,arg5,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type const &)*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__SparseMatrix32_max__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type *arg2 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type *arg3 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg4 = 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 ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_max" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_unsigned_int,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SparseMatrix32_max" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_max" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type * >(argp2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_unsigned_int,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "_SparseMatrix32_max" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_max" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &""'"); 
  }
  arg3 = reinterpret_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type * >(argp3);
  res4 = SWIG_ConvertPtr(swig_obj[3], &argp4, SWIGTYPE_p_float,  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "_SparseMatrix32_max" "', argument " "4"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type &""'"); 
  }
  if (!argp4) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_max" "', argument " "4"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type &""'"); 
  }
  arg4 = reinterpret_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type * >(argp4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->max(*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__SparseMatrix32_min__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type *arg2 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type *arg3 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg4 = 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 ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_min" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_unsigned_int,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SparseMatrix32_min" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_min" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type * >(argp2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_unsigned_int,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "_SparseMatrix32_min" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_min" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &""'"); 
  }
  arg3 = reinterpret_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type * >(argp3);
  res4 = SWIG_ConvertPtr(swig_obj[3], &argp4, SWIGTYPE_p_float,  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "_SparseMatrix32_min" "', argument " "4"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type &""'"); 
  }
  if (!argp4) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_min" "', argument " "4"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type &""'"); 
  }
  arg4 = reinterpret_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type * >(argp4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->min(*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__SparseMatrix32_rowMax__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type *arg3 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rowMax" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_rowMax" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_unsigned_int,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "_SparseMatrix32_rowMax" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_rowMax" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &""'"); 
  }
  arg3 = reinterpret_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type * >(argp3);
  res4 = SWIG_ConvertPtr(swig_obj[3], &argp4, SWIGTYPE_p_float,  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "_SparseMatrix32_rowMax" "', argument " "4"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type &""'"); 
  }
  if (!argp4) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_rowMax" "', argument " "4"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type &""'"); 
  }
  arg4 = reinterpret_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type * >(argp4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->rowMax(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__SparseMatrix32_rowMin__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type *arg3 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rowMin" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_rowMin" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_unsigned_int,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "_SparseMatrix32_rowMin" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_rowMin" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &""'"); 
  }
  arg3 = reinterpret_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type * >(argp3);
  res4 = SWIG_ConvertPtr(swig_obj[3], &argp4, SWIGTYPE_p_float,  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "_SparseMatrix32_rowMin" "', argument " "4"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type &""'"); 
  }
  if (!argp4) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_rowMin" "', argument " "4"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type &""'"); 
  }
  arg4 = reinterpret_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type * >(argp4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->rowMin(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__SparseMatrix32_colMax__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type *arg3 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_colMax" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_colMax" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_unsigned_int,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "_SparseMatrix32_colMax" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_colMax" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &""'"); 
  }
  arg3 = reinterpret_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type * >(argp3);
  res4 = SWIG_ConvertPtr(swig_obj[3], &argp4, SWIGTYPE_p_float,  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "_SparseMatrix32_colMax" "', argument " "4"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type &""'"); 
  }
  if (!argp4) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_colMax" "', argument " "4"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type &""'"); 
  }
  arg4 = reinterpret_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type * >(argp4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->colMax(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__SparseMatrix32_colMin__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type *arg3 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_colMin" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_colMin" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_unsigned_int,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "_SparseMatrix32_colMin" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_colMin" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &""'"); 
  }
  arg3 = reinterpret_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type * >(argp3);
  res4 = SWIG_ConvertPtr(swig_obj[3], &argp4, SWIGTYPE_p_float,  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "_SparseMatrix32_colMin" "', argument " "4"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type &""'"); 
  }
  if (!argp4) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_colMin" "', argument " "4"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type &""'"); 
  }
  arg4 = reinterpret_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type * >(argp4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->colMin(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__SparseMatrix32_boxMin__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg3 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg4 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg5 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type *arg6 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type *arg7 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg8 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  unsigned int val5 ;
  int ecode5 = 0 ;
  void *argp6 = 0 ;
  int res6 = 0 ;
  void *argp7 = 0 ;
  int res7 = 0 ;
  void *argp8 = 0 ;
  int res8 = 0 ;
  
  if ((nobjs < 8) || (nobjs > 8)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_boxMin" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_boxMin" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_boxMin" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_boxMin" "', argument " "4"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg4 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val4);
  ecode5 = SWIG_AsVal_unsigned_SS_int(swig_obj[4], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "_SparseMatrix32_boxMin" "', argument " "5"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg5 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val5);
  res6 = SWIG_ConvertPtr(swig_obj[5], &argp6, SWIGTYPE_p_unsigned_int,  0 );
  if (!SWIG_IsOK(res6)) {
    SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "_SparseMatrix32_boxMin" "', argument " "6"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &""'"); 
  }
  if (!argp6) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_boxMin" "', argument " "6"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &""'"); 
  }
  arg6 = reinterpret_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type * >(argp6);
  res7 = SWIG_ConvertPtr(swig_obj[6], &argp7, SWIGTYPE_p_unsigned_int,  0 );
  if (!SWIG_IsOK(res7)) {
    SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "_SparseMatrix32_boxMin" "', argument " "7"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &""'"); 
  }
  if (!argp7) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_boxMin" "', argument " "7"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &""'"); 
  }
  arg7 = reinterpret_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type * >(argp7);
  res8 = SWIG_ConvertPtr(swig_obj[7], &argp8, SWIGTYPE_p_float,  0 );
  if (!SWIG_IsOK(res8)) {
    SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "_SparseMatrix32_boxMin" "', argument " "8"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type &""'"); 
  }
  if (!argp8) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_boxMin" "', argument " "8"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type &""'"); 
  }
  arg8 = reinterpret_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type * >(argp8);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->boxMin(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_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_boxMax__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg3 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg4 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg5 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type *arg6 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type *arg7 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg8 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  unsigned int val5 ;
  int ecode5 = 0 ;
  void *argp6 = 0 ;
  int res6 = 0 ;
  void *argp7 = 0 ;
  int res7 = 0 ;
  void *argp8 = 0 ;
  int res8 = 0 ;
  
  if ((nobjs < 8) || (nobjs > 8)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_boxMax" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_boxMax" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_boxMax" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_boxMax" "', argument " "4"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg4 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val4);
  ecode5 = SWIG_AsVal_unsigned_SS_int(swig_obj[4], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "_SparseMatrix32_boxMax" "', argument " "5"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg5 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val5);
  res6 = SWIG_ConvertPtr(swig_obj[5], &argp6, SWIGTYPE_p_unsigned_int,  0 );
  if (!SWIG_IsOK(res6)) {
    SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "_SparseMatrix32_boxMax" "', argument " "6"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &""'"); 
  }
  if (!argp6) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_boxMax" "', argument " "6"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &""'"); 
  }
  arg6 = reinterpret_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type * >(argp6);
  res7 = SWIG_ConvertPtr(swig_obj[6], &argp7, SWIGTYPE_p_unsigned_int,  0 );
  if (!SWIG_IsOK(res7)) {
    SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "_SparseMatrix32_boxMax" "', argument " "7"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &""'"); 
  }
  if (!argp7) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_boxMax" "', argument " "7"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &""'"); 
  }
  arg7 = reinterpret_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type * >(argp7);
  res8 = SWIG_ConvertPtr(swig_obj[7], &argp8, SWIGTYPE_p_float,  0 );
  if (!SWIG_IsOK(res8)) {
    SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "_SparseMatrix32_boxMax" "', argument " "8"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type &""'"); 
  }
  if (!argp8) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_boxMax" "', argument " "8"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type &""'"); 
  }
  arg8 = reinterpret_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type * >(argp8);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->boxMax(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_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_argmax(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::pair< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_argmax" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->argmax();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__SparseMatrix32_argmin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::pair< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_argmin" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->argmin();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__SparseMatrix32_normalizeRow(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type arg3_defvalue = 1.0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg3 = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *) &arg3_defvalue ;
  bool arg4 = (bool) false ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp3 ;
  float 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 *) "row",(char *) "val",(char *) "exact", NULL 
  };
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|OO:_SparseMatrix32_normalizeRow",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_normalizeRow" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_normalizeRow" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  if (obj2) {
    ecode3 = SWIG_AsVal_float(obj2, &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_normalizeRow" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
    } 
    temp3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val3);
    arg3 = &temp3;
  }
  if (obj3) {
    ecode4 = SWIG_AsVal_bool(obj3, &val4);
    if (!SWIG_IsOK(ecode4)) {
      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_normalizeRow" "', 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::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type)(arg1)->normalizeRow(arg2,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type 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_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_normalizeCol(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type arg3_defvalue = 1.0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg3 = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *) &arg3_defvalue ;
  bool arg4 = (bool) false ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp3 ;
  float 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 *) "col",(char *) "val",(char *) "exact", NULL 
  };
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|OO:_SparseMatrix32_normalizeCol",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_normalizeCol" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_normalizeCol" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  if (obj2) {
    ecode3 = SWIG_AsVal_float(obj2, &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_normalizeCol" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
    } 
    temp3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val3);
    arg3 = &temp3;
  }
  if (obj3) {
    ecode4 = SWIG_AsVal_bool(obj3, &val4);
    if (!SWIG_IsOK(ecode4)) {
      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_normalizeCol" "', 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::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type)(arg1)->normalizeCol(arg2,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type 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_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_normalizeRows(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type arg2_defvalue = 1.0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg2 = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *) &arg2_defvalue ;
  bool arg3 = (bool) false ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp2 ;
  float val2 ;
  int ecode2 = 0 ;
  bool val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "val",(char *) "exact", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OO:_SparseMatrix32_normalizeRows",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_normalizeRows" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  if (obj1) {
    ecode2 = SWIG_AsVal_float(obj1, &val2);
    if (!SWIG_IsOK(ecode2)) {
      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_normalizeRows" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
    } 
    temp2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val2);
    arg2 = &temp2;
  }
  if (obj2) {
    ecode3 = SWIG_AsVal_bool(obj2, &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_normalizeRows" "', 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)->normalizeRows((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type 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__SparseMatrix32_normalizeCols(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type arg2_defvalue = 1.0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg2 = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *) &arg2_defvalue ;
  bool arg3 = (bool) false ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp2 ;
  float val2 ;
  int ecode2 = 0 ;
  bool val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "val",(char *) "exact", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OO:_SparseMatrix32_normalizeCols",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_normalizeCols" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  if (obj1) {
    ecode2 = SWIG_AsVal_float(obj1, &val2);
    if (!SWIG_IsOK(ecode2)) {
      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_normalizeCols" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
    } 
    temp2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val2);
    arg2 = &temp2;
  }
  if (obj2) {
    ecode3 = SWIG_AsVal_bool(obj2, &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_normalizeCols" "', 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)->normalizeCols((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type 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__SparseMatrix32_normalize(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type arg2_defvalue = 1.0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg2 = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *) &arg2_defvalue ;
  bool arg3 = (bool) false ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp2 ;
  float val2 ;
  int ecode2 = 0 ;
  bool val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "val",(char *) "exact", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OO:_SparseMatrix32_normalize",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_normalize" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  if (obj1) {
    ecode2 = SWIG_AsVal_float(obj1, &val2);
    if (!SWIG_IsOK(ecode2)) {
      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_normalize" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
    } 
    temp2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val2);
    arg2 = &temp2;
  }
  if (obj2) {
    ecode3 = SWIG_AsVal_bool(obj2, &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_normalize" "', 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)->normalize((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type 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__SparseMatrix32_normalize_max(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type arg2_defvalue = 1.0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg2 = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *) &arg2_defvalue ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp2 ;
  float val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "val", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:_SparseMatrix32_normalize_max",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_normalize_max" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  if (obj1) {
    ecode2 = SWIG_AsVal_float(obj1, &val2);
    if (!SWIG_IsOK(ecode2)) {
      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_normalize_max" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
    } 
    temp2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val2);
    arg2 = &temp2;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->normalize_max((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::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__SparseMatrix32_rowSum(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row", NULL 
  };
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_rowSum",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rowSum" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_rowSum" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->rowSum(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__SparseMatrix32_rowSums__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > *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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rowSums" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(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 '" "_SparseMatrix32_rowSums" "', argument " "2"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_rowSums" "', argument " "2"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->rowSums(*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__SparseMatrix32_rowProd(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row", NULL 
  };
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_rowProd",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rowProd" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_rowProd" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->rowProd(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__SparseMatrix32_colSum(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "col", NULL 
  };
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_colSum",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_colSum" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_colSum" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->colSum(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__SparseMatrix32_colProd(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "col", NULL 
  };
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_colProd",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_colProd" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_colProd" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->colProd(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__SparseMatrix32_sum(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_sum" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->sum();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__SparseMatrix32_prod(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_prod" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->prod();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__SparseMatrix32_lerp(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type arg3 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  float val2 ;
  int ecode2 = 0 ;
  float val3 ;
  int ecode3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "a",(char *) "b",(char *) "B", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:_SparseMatrix32_lerp",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_lerp" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_lerp" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val2);
  ecode3 = SWIG_AsVal_float(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_lerp" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  arg3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val3);
  res4 = SWIG_ConvertPtr(obj3, &argp4, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0  | 0);
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "_SparseMatrix32_lerp" "', argument " "4"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  if (!argp4) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_lerp" "', argument " "4"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  arg4 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->lerp(arg2,arg3,(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > 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__SparseMatrix32_addTwoRows(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "src_row",(char *) "dst_row", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SparseMatrix32_addTwoRows",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_addTwoRows" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_addTwoRows" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_addTwoRows" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->addTwoRows(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__SparseMatrix32_addTwoCols(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "src_col",(char *) "dst_col", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SparseMatrix32_addTwoCols",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_addTwoCols" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_addTwoCols" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_addTwoCols" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->addTwoCols(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__SparseMatrix32_add__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_add" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SparseMatrix32_add" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_add" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->add((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > 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__SparseMatrix32_multiply__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg2 = 0 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_multiply" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SparseMatrix32_multiply" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_multiply" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "_SparseMatrix32_multiply" "', argument " "3"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_multiply" "', argument " "3"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  arg3 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->multiply((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > 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__SparseMatrix32_elementMultiply__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementMultiply" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SparseMatrix32_elementMultiply" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_elementMultiply" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementMultiply((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > 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__SparseMatrix32_elementMultiply__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg2 = 0 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementMultiply" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SparseMatrix32_elementMultiply" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_elementMultiply" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "_SparseMatrix32_elementMultiply" "', argument " "3"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_elementMultiply" "', argument " "3"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  arg3 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->elementMultiply((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > 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__SparseMatrix32_elementMultiply__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg2 = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementMultiply" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(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 '" "_SparseMatrix32_elementMultiply" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementMultiply(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__SparseMatrix32_elementMultiply__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg2 = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *) 0 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementMultiply" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(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 '" "_SparseMatrix32_elementMultiply" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type * >(argp2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "_SparseMatrix32_elementMultiply" "', argument " "3"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_elementMultiply" "', argument " "3"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  arg3 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->elementMultiply(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__SparseMatrix32_rightVecProd__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rightVecProd" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_rightVecProd" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    std::vector<float,std::allocator< float > > *ptr = (std::vector<float,std::allocator< float > > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "_SparseMatrix32_rightVecProd" "', argument " "3"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_rightVecProd" "', argument " "3"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->rightVecProd(arg2,(std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::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_From_float(static_cast< float >(result));
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_rightVecProd__SWIG_4(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > *arg2 = 0 ;
  std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rightVecProd" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(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 '" "_SparseMatrix32_rightVecProd" "', argument " "2"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_rightVecProd" "', argument " "2"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &""'"); 
    }
    arg2 = ptr;
  }
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "_SparseMatrix32_rightVecProd" "', argument " "3"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_rightVecProd" "', argument " "3"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > &""'"); 
  }
  arg3 = reinterpret_cast< std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->rightVecProd((std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > 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__SparseMatrix32_leftVecProd__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_leftVecProd" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_leftVecProd" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    std::vector<float,std::allocator< float > > *ptr = (std::vector<float,std::allocator< float > > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "_SparseMatrix32_leftVecProd" "', argument " "3"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_leftVecProd" "', argument " "3"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->leftVecProd(arg2,(std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::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_From_float(static_cast< float >(result));
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_leftVecProd__SWIG_4(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > *arg2 = 0 ;
  std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_leftVecProd" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(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 '" "_SparseMatrix32_leftVecProd" "', argument " "2"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_leftVecProd" "', argument " "2"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &""'"); 
    }
    arg2 = ptr;
  }
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "_SparseMatrix32_leftVecProd" "', argument " "3"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_leftVecProd" "', argument " "3"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > &""'"); 
  }
  arg3 = reinterpret_cast< std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->leftVecProd((std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > 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__SparseMatrix32_map(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg2 = 0 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *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 *) "B",(char *) "C", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SparseMatrix32_map",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_map" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SparseMatrix32_map" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_map" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp2);
  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "_SparseMatrix32_map" "', argument " "3"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_map" "', argument " "3"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  arg3 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->map((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > 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__SparseMatrix32_incrementWithOuterProduct(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > *arg2 = 0 ;
  std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  int res3 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x",(char *) "y", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SparseMatrix32_incrementWithOuterProduct",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_incrementWithOuterProduct" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    std::vector<float,std::allocator< float > > *ptr = (std::vector<float,std::allocator< float > > *)0;
    res2 = swig::asptr(obj1, &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SparseMatrix32_incrementWithOuterProduct" "', argument " "2"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_incrementWithOuterProduct" "', argument " "2"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &""'"); 
    }
    arg2 = ptr;
  }
  {
    std::vector<float,std::allocator< float > > *ptr = (std::vector<float,std::allocator< float > > *)0;
    res3 = swig::asptr(obj2, &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "_SparseMatrix32_incrementWithOuterProduct" "', argument " "3"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_incrementWithOuterProduct" "', argument " "3"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->incrementWithOuterProduct((std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &)*arg2,(std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::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();
  if (SWIG_IsNewObj(res2)) delete arg2;
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_incrementOnOuterProductVal(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::size_type > > *arg2 = 0 ;
  std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::size_type > > *arg3 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type arg4_defvalue = 1.0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg4 = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *) &arg4_defvalue ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  int res3 = SWIG_OLDOBJ ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp4 ;
  float val4 ;
  int ecode4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "rows",(char *) "cols",(char *) "val", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:_SparseMatrix32_incrementOnOuterProductVal",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_incrementOnOuterProductVal" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(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 '" "_SparseMatrix32_incrementOnOuterProductVal" "', argument " "2"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::size_type > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_incrementOnOuterProductVal" "', argument " "2"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::size_type > > const &""'"); 
    }
    arg2 = ptr;
  }
  {
    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 '" "_SparseMatrix32_incrementOnOuterProductVal" "', argument " "3"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::size_type > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_incrementOnOuterProductVal" "', argument " "3"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::size_type > > const &""'"); 
    }
    arg3 = ptr;
  }
  if (obj3) {
    ecode4 = SWIG_AsVal_float(obj3, &val4);
    if (!SWIG_IsOK(ecode4)) {
      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_incrementOnOuterProductVal" "', argument " "4"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
    } 
    temp4 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val4);
    arg4 = &temp4;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->incrementOnOuterProductVal((std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::size_type > > const &)*arg2,(std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::size_type > > const &)*arg3,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type 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(res2)) delete arg2;
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


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


SWIGINTERN PyObject *_wrap__SparseMatrix32_replaceNZ(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type arg2_defvalue = 1.0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg2 = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *) &arg2_defvalue ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp2 ;
  float val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "val", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:_SparseMatrix32_replaceNZ",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_replaceNZ" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  if (obj1) {
    ecode2 = SWIG_AsVal_float(obj1, &val2);
    if (!SWIG_IsOK(ecode2)) {
      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_replaceNZ" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
    } 
    temp2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val2);
    arg2 = &temp2;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->replaceNZ((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::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__SparseMatrix32_diagNZProd(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_diagNZProd" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->diagNZProd();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__SparseMatrix32_diagSum(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_diagSum" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->diagSum();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__SparseMatrix32_diagNZLogSum(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_diagNZLogSum" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type)((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->diagNZLogSum();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__SparseMatrix32_rowNegate(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "idx", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_rowNegate",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rowNegate" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_rowNegate" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->rowNegate(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__SparseMatrix32_colNegate(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "idx", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_colNegate",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_colNegate" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_colNegate" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->colNegate(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__SparseMatrix32_negate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_negate" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->negate();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_rowAbs(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "idx", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_rowAbs",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rowAbs" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_rowAbs" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->rowAbs(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__SparseMatrix32_colAbs(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "idx", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_colAbs",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_colAbs" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_colAbs" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->colAbs(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__SparseMatrix32_abs(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_abs" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->abs();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_elementRowSquare(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "idx", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_elementRowSquare",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementRowSquare" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementRowSquare" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementRowSquare(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__SparseMatrix32_elementColSquare(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "idx", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_elementColSquare",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementColSquare" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementColSquare" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementColSquare(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__SparseMatrix32_elementSquare(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementSquare" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementSquare();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_elementRowCube(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "idx", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_elementRowCube",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementRowCube" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementRowCube" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementRowCube(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__SparseMatrix32_elementColCube(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "idx", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_elementColCube",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementColCube" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementColCube" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementColCube(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__SparseMatrix32_elementCube(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementCube" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementCube();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_elementRowNZInverse(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "idx", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_elementRowNZInverse",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementRowNZInverse" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementRowNZInverse" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementRowNZInverse(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__SparseMatrix32_elementColNZInverse(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "idx", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_elementColNZInverse",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementColNZInverse" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementColNZInverse" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementColNZInverse(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__SparseMatrix32_elementNZInverse(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementNZInverse" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementNZInverse();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_elementRowSqrt(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "idx", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_elementRowSqrt",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementRowSqrt" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementRowSqrt" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementRowSqrt(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__SparseMatrix32_elementColSqrt(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "idx", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_elementColSqrt",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementColSqrt" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementColSqrt" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementColSqrt(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__SparseMatrix32_elementSqrt(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementSqrt" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementSqrt();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_elementRowNZLog(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "idx", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_elementRowNZLog",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementRowNZLog" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementRowNZLog" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementRowNZLog(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__SparseMatrix32_elementColNZLog(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "idx", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_elementColNZLog",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementColNZLog" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementColNZLog" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementColNZLog(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__SparseMatrix32_elementNZLog(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementNZLog" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementNZLog();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_elementRowNZExp(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "idx", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_elementRowNZExp",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementRowNZExp" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementRowNZExp" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementRowNZExp(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__SparseMatrix32_elementColNZExp(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "idx", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_elementColNZExp",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementColNZExp" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementColNZExp" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementColNZExp(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__SparseMatrix32_elementNZExp(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementNZExp" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementNZExp();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_elementRowMultiply__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp3 ;
  float val3 ;
  int ecode3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementRowMultiply" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementRowMultiply" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_float(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_elementRowMultiply" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  temp3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementRowMultiply(arg2,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::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__SparseMatrix32_elementRowMultiply__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > *arg3 = 0 ;
  std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementRowMultiply" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementRowMultiply" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    std::vector<float,std::allocator< float > > *ptr = (std::vector<float,std::allocator< float > > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "_SparseMatrix32_elementRowMultiply" "', argument " "3"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_elementRowMultiply" "', argument " "3"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &""'"); 
    }
    arg3 = ptr;
  }
  res4 = SWIG_ConvertPtr(swig_obj[3], &argp4, SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t,  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "_SparseMatrix32_elementRowMultiply" "', argument " "4"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > &""'"); 
  }
  if (!argp4) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_elementRowMultiply" "', argument " "4"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > &""'"); 
  }
  arg4 = reinterpret_cast< std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > * >(argp4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->elementRowMultiply(arg2,(std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > 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_Py_Void();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_elementColMultiply__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp3 ;
  float val3 ;
  int ecode3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementColMultiply" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementColMultiply" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_float(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_elementColMultiply" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  temp3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementColMultiply(arg2,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::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__SparseMatrix32_elementColMultiply__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > *arg3 = 0 ;
  std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementColMultiply" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementColMultiply" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  {
    std::vector<float,std::allocator< float > > *ptr = (std::vector<float,std::allocator< float > > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "_SparseMatrix32_elementColMultiply" "', argument " "3"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_elementColMultiply" "', argument " "3"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &""'"); 
    }
    arg3 = ptr;
  }
  res4 = SWIG_ConvertPtr(swig_obj[3], &argp4, SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t,  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "_SparseMatrix32_elementColMultiply" "', argument " "4"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > &""'"); 
  }
  if (!argp4) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_elementColMultiply" "', argument " "4"" of type '" "std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > &""'"); 
  }
  arg4 = reinterpret_cast< std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > * >(argp4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *)arg1)->elementColMultiply(arg2,(std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > 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_Py_Void();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_multiply__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp2 ;
  float val2 ;
  int ecode2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_multiply" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_float(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_multiply" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  temp2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->multiply((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::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__SparseMatrix32_multiply(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SparseMatrix32_multiply",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_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_float(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_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0);
        _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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 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_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_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__SparseMatrix32_multiply__SWIG_1(self, argc, argv);
    case 2:
      return _wrap__SparseMatrix32_multiply__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SparseMatrix32_multiply'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::multiply(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &,nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &) const\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::multiply(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_elementRowDivide__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp3 ;
  float val3 ;
  int ecode3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementRowDivide" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementRowDivide" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_float(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_elementRowDivide" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  temp3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementRowDivide(arg2,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::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__SparseMatrix32_elementColDivide__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp3 ;
  float val3 ;
  int ecode3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementColDivide" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementColDivide" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_float(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_elementColDivide" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  temp3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementColDivide(arg2,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::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__SparseMatrix32_divide(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp2 ;
  float val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "val", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_divide",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_divide" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_divide" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  temp2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->divide((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::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__SparseMatrix32_elementRowNZPow(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp3 ;
  float val3 ;
  int ecode3 = 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:_SparseMatrix32_elementRowNZPow",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementRowNZPow" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementRowNZPow" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_float(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_elementRowNZPow" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  temp3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementRowNZPow(arg2,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::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__SparseMatrix32_elementColNZPow(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp3 ;
  float val3 ;
  int ecode3 = 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:_SparseMatrix32_elementColNZPow",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementColNZPow" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementColNZPow" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_float(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_elementColNZPow" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  temp3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementColNZPow(arg2,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::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__SparseMatrix32_elementNZPow(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp2 ;
  float val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "val", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_elementNZPow",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementNZPow" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementNZPow" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  temp2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementNZPow((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::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__SparseMatrix32_elementRowNZLogk(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp3 ;
  float val3 ;
  int ecode3 = 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:_SparseMatrix32_elementRowNZLogk",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementRowNZLogk" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementRowNZLogk" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_float(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_elementRowNZLogk" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  temp3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementRowNZLogk(arg2,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::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__SparseMatrix32_elementColNZLogk(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp3 ;
  float val3 ;
  int ecode3 = 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:_SparseMatrix32_elementColNZLogk",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementColNZLogk" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementColNZLogk" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_float(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_elementColNZLogk" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  temp3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementColNZLogk(arg2,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::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__SparseMatrix32_elementNZLogk(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp2 ;
  float val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "val", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_elementNZLogk",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementNZLogk" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementNZLogk" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  temp2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementNZLogk((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::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__SparseMatrix32_rowAdd(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp3 ;
  float val3 ;
  int ecode3 = 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:_SparseMatrix32_rowAdd",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rowAdd" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_rowAdd" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_float(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_rowAdd" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  temp3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->rowAdd(arg2,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::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__SparseMatrix32_colAdd(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp3 ;
  float val3 ;
  int ecode3 = 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:_SparseMatrix32_colAdd",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_colAdd" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_colAdd" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_float(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_colAdd" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  temp3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->colAdd(arg2,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::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__SparseMatrix32_add__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp2 ;
  float val2 ;
  int ecode2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_add" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_float(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_add" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  temp2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->add((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::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__SparseMatrix32_add(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SparseMatrix32_add",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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0);
        _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;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap__SparseMatrix32_add__SWIG_0(self, argc, argv);
    case 2:
      return _wrap__SparseMatrix32_add__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SparseMatrix32_add'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::add(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &)\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::add(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_elementNZAdd(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp2 ;
  float val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "val", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_elementNZAdd",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementNZAdd" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementNZAdd" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  temp2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementNZAdd((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::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__SparseMatrix32_rowSubtract(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp3 ;
  float val3 ;
  int ecode3 = 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:_SparseMatrix32_rowSubtract",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rowSubtract" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_rowSubtract" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_float(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_rowSubtract" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  temp3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->rowSubtract(arg2,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::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__SparseMatrix32_colSubtract(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type arg2 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp3 ;
  float val3 ;
  int ecode3 = 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:_SparseMatrix32_colSubtract",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_colSubtract" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_colSubtract" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type >(val2);
  ecode3 = SWIG_AsVal_float(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_colSubtract" "', argument " "3"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  temp3 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->colSubtract(arg2,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::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__SparseMatrix32_subtract__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp2 ;
  float val2 ;
  int ecode2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_subtract" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_float(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_subtract" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  temp2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->subtract((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::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__SparseMatrix32_elementNZMultiply(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *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 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_elementNZMultiply",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementNZMultiply" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SparseMatrix32_elementNZMultiply" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_elementNZMultiply" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementNZMultiply((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > 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__SparseMatrix32_elementNZDivide(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *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 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_elementNZDivide",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementNZDivide" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SparseMatrix32_elementNZDivide" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_elementNZDivide" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->elementNZDivide((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > 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__SparseMatrix32_subtract__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_subtract" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SparseMatrix32_subtract" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_subtract" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->subtract((nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > 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__SparseMatrix32_subtract(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SparseMatrix32_subtract",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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0);
        _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;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap__SparseMatrix32_subtract__SWIG_1(self, argc, argv);
    case 2:
      return _wrap__SparseMatrix32_subtract__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SparseMatrix32_subtract'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::subtract(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type const &)\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::subtract(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32___iadd__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp2 ;
  float val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "val", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32___iadd__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32___iadd__" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32___iadd__" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  temp2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->operator +=((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::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__SparseMatrix32___isub__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp2 ;
  float val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "val", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32___isub__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32___isub__" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32___isub__" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  temp2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->operator -=((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::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__SparseMatrix32___imul__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp2 ;
  float val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "val", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32___imul__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32___imul__" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32___imul__" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  temp2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->operator *=((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::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__SparseMatrix32___idiv__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type temp2 ;
  float val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "val", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32___idiv__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32___idiv__" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32___idiv__" "', argument " "2"" of type '" "nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type""'");
  } 
  temp2 = static_cast< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->operator /=((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::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__SparseMatrix32___initializeWithRows(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg2 = 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  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 *) "other",(char *) "py_take", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SparseMatrix32___initializeWithRows",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32___initializeWithRows" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SparseMatrix32___initializeWithRows" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32___initializeWithRows" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp2);
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg____initializeWithRows(arg1,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32___initializeWithCols(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg2 = 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  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 *) "other",(char *) "py_take", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SparseMatrix32___initializeWithCols",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32___initializeWithCols" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SparseMatrix32___initializeWithCols" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32___initializeWithCols" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp2);
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg____initializeWithCols(arg1,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32___add(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "val", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32___add",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32___add" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg____add(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__SparseMatrix32___multiply(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "val", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32___multiply",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32___multiply" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg____multiply(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__SparseMatrix32___subtract(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "val", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32___subtract",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32___subtract" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg____subtract(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__SparseMatrix32___divide(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "val", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32___divide",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32___divide" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg____divide(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__SparseMatrix32_copy(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *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 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_copy",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_copy" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SparseMatrix32_copy" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_copy" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__copy(arg1,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_fromDense(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "matrix", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_fromDense",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_fromDense" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__fromDense(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__SparseMatrix32_toDense(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_toDense" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__toDense((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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__SparseMatrix32__setRowFromDense(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row",(char *) "py_row", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SparseMatrix32__setRowFromDense",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32__setRowFromDense" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32__setRowFromDense" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg___setRowFromDense(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__SparseMatrix32_setRowFromSparse(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  PyObject *arg4 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row",(char *) "py_ind",(char *) "py_nz", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:_SparseMatrix32_setRowFromSparse",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_setRowFromSparse" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_setRowFromSparse" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  arg3 = obj2;
  arg4 = obj3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__setRowFromSparse(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__SparseMatrix32_binarySaveToFile(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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 *) "filename", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_binarySaveToFile",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_binarySaveToFile" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(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 '" "_SparseMatrix32_binarySaveToFile" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_binarySaveToFile" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__binarySaveToFile(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__SparseMatrix32_binaryLoadFromFile(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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 *) "filename", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_binaryLoadFromFile",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_binaryLoadFromFile" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(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 '" "_SparseMatrix32_binaryLoadFromFile" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_binaryLoadFromFile" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__binaryLoadFromFile(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__SparseMatrix32_write__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_write" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = swig_obj[1];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__write__SWIG_1((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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 *_wrap__SparseMatrix32_write(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SparseMatrix32_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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_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_SparseMatrixProto__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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_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;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap__SparseMatrix32_write__SWIG_0(self, argc, argv);
    case 2:
      return _wrap__SparseMatrix32_write__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SparseMatrix32_write'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::write(SparseMatrixProto::Builder &) const\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::write(PyObject *) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_read__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_read" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = swig_obj[1];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__read__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__SparseMatrix32_read(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SparseMatrix32_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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_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_SparseMatrixProto__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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_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;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap__SparseMatrix32_read__SWIG_0(self, argc, argv);
    case 2:
      return _wrap__SparseMatrix32_read__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SparseMatrix32_read'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::read(SparseMatrixProto::Reader &)\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::read(PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_addRow(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_addRow",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_addRow" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__addRow(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__SparseMatrix32_addRowNZ(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  bool arg4 = (bool) false ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool val4 ;
  int ecode4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "ind",(char *) "nz",(char *) "zero_permissive", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:_SparseMatrix32_addRowNZ",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_addRowNZ" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  arg3 = obj2;
  if (obj3) {
    ecode4 = SWIG_AsVal_bool(obj3, &val4);
    if (!SWIG_IsOK(ecode4)) {
      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_addRowNZ" "', argument " "4"" of type '" "bool""'");
    } 
    arg4 = static_cast< bool >(val4);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__addRowNZ(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__SparseMatrix32_addCol(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "col", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_addCol",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_addCol" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__addCol(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__SparseMatrix32_addColNZ(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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 *) "ind",(char *) "nz", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SparseMatrix32_addColNZ",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_addColNZ" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__addColNZ(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__SparseMatrix32_deleteRows(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "rowIndices", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_deleteRows",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_deleteRows" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__deleteRows(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__SparseMatrix32_deleteCols(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "colIndices", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_deleteCols",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_deleteCols" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__deleteCols(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__SparseMatrix32_getRow(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_getRow",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_getRow" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_getRow" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__getRow((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_getCol(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "col", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_getCol",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_getCol" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_getCol" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__getCol((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_getDiagonal(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_getDiagonal" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__getDiagonal((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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__SparseMatrix32_rowNonZeros(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_rowNonZeros",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rowNonZeros" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_rowNonZeros" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rowNonZeros((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_rowNonZeroIndices(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_rowNonZeroIndices",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rowNonZeroIndices" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_rowNonZeroIndices" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rowNonZeroIndices((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_colNonZeros(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "col", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_colNonZeros",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_colNonZeros" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_colNonZeros" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__colNonZeros((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_nonZeroRows(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_nonZeroRows" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__nonZeroRows((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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__SparseMatrix32_zeroRows(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_zeroRows" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__zeroRows((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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__SparseMatrix32_nonZeroCols(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_nonZeroCols" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__nonZeroCols((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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__SparseMatrix32_zeroCols(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_zeroCols" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__zeroCols((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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__SparseMatrix32_zeroRowAndCol(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_zeroRowAndCol" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__zeroRowAndCol((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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__SparseMatrix32_setElements(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  PyObject *arg4 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_i",(char *) "py_j",(char *) "py_v", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:_SparseMatrix32_setElements",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_setElements" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  arg3 = obj2;
  arg4 = obj3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__setElements(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__SparseMatrix32_getElements(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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 *) "py_i",(char *) "py_j", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SparseMatrix32_getElements",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_getElements" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__getElements((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_setOuter(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  PyObject *arg4 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_i",(char *) "py_j",(char *) "py_v", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:_SparseMatrix32_setOuter",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_setOuter" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  arg3 = obj2;
  arg4 = obj3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__setOuter(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__SparseMatrix32_getOuter(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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 *) "py_i",(char *) "py_j", NULL 
  };
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SparseMatrix32_getOuter",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_getOuter" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__getOuter((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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((new nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >(static_cast< const nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >& >(result))), SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_getAllNonZeros(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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 *) "three_lists", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:_SparseMatrix32_getAllNonZeros",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_getAllNonZeros" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  if (obj1) {
    ecode2 = SWIG_AsVal_bool(obj1, &val2);
    if (!SWIG_IsOK(ecode2)) {
      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_getAllNonZeros" "', 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 = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__getAllNonZeros((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_setAllNonZeros(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  nupic::UInt32 arg3 ;
  PyObject *arg4 = (PyObject *) 0 ;
  PyObject *arg5 = (PyObject *) 0 ;
  PyObject *arg6 = (PyObject *) 0 ;
  bool arg7 = (bool) true ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 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 *) "self",(char *) "nrows",(char *) "ncols",(char *) "py_i",(char *) "py_j",(char *) "py_v",(char *) "sorted", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOOO|O:_SparseMatrix32_setAllNonZeros",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_setAllNonZeros" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_setAllNonZeros" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_setAllNonZeros" "', argument " "3"" of type '" "nupic::UInt32""'");
  } 
  arg3 = static_cast< nupic::UInt32 >(val3);
  arg4 = obj3;
  arg5 = obj4;
  arg6 = obj5;
  if (obj6) {
    ecode7 = SWIG_AsVal_bool(obj6, &val7);
    if (!SWIG_IsOK(ecode7)) {
      SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "_SparseMatrix32_setAllNonZeros" "', argument " "7"" of type '" "bool""'");
    } 
    arg7 = static_cast< bool >(val7);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__setAllNonZeros(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__SparseMatrix32_getNonZerosInBox(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  nupic::UInt32 arg3 ;
  nupic::UInt32 arg4 ;
  nupic::UInt32 arg5 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  unsigned int val5 ;
  int ecode5 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row_begin",(char *) "row_end",(char *) "col_begin",(char *) "col_end", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOO:_SparseMatrix32_getNonZerosInBox",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_getNonZerosInBox" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_getNonZerosInBox" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_getNonZerosInBox" "', argument " "3"" of type '" "nupic::UInt32""'");
  } 
  arg3 = static_cast< nupic::UInt32 >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_getNonZerosInBox" "', argument " "4"" of type '" "nupic::UInt32""'");
  } 
  arg4 = static_cast< nupic::UInt32 >(val4);
  ecode5 = SWIG_AsVal_unsigned_SS_int(obj4, &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "_SparseMatrix32_getNonZerosInBox" "', argument " "5"" of type '" "nupic::UInt32""'");
  } 
  arg5 = static_cast< nupic::UInt32 >(val5);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__getNonZerosInBox((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > const *)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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_tolist(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_tolist" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__tolist((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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__SparseMatrix32_setSlice__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  nupic::UInt32 arg3 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_setSlice" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_setSlice" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_setSlice" "', argument " "3"" of type '" "nupic::UInt32""'");
  } 
  arg3 = static_cast< nupic::UInt32 >(val3);
  res4 = SWIG_ConvertPtr(swig_obj[3], &argp4, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0  | 0);
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "_SparseMatrix32_setSlice" "', argument " "4"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  if (!argp4) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32_setSlice" "', argument " "4"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  arg4 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__setSlice__SWIG_1(arg1,arg2,arg3,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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__SparseMatrix32_setSlice__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  nupic::UInt32 arg3 ;
  PyObject *arg4 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_setSlice" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_setSlice" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_setSlice" "', argument " "3"" of type '" "nupic::UInt32""'");
  } 
  arg3 = static_cast< nupic::UInt32 >(val3);
  arg4 = swig_obj[3];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__setSlice__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__SparseMatrix32_setSlice(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SparseMatrix32_setSlice",0,4,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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_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_ConvertPtr(argv[3], 0, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_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 == 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 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;
      {
        {
          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;
      {
        _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:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap__SparseMatrix32_setSlice__SWIG_1(self, argc, argv);
    case 2:
      return _wrap__SparseMatrix32_setSlice__SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SparseMatrix32_setSlice'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::setSlice(nupic::UInt32,nupic::UInt32,nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &)\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::setSlice(nupic::UInt32,nupic::UInt32,PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_getSlice(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  nupic::UInt32 arg3 ;
  nupic::UInt32 arg4 ;
  nupic::UInt32 arg5 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  unsigned int val5 ;
  int ecode5 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i_begin",(char *) "i_end",(char *) "j_begin",(char *) "j_end", NULL 
  };
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOO:_SparseMatrix32_getSlice",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_getSlice" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_getSlice" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_getSlice" "', argument " "3"" of type '" "nupic::UInt32""'");
  } 
  arg3 = static_cast< nupic::UInt32 >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_getSlice" "', argument " "4"" of type '" "nupic::UInt32""'");
  } 
  arg4 = static_cast< nupic::UInt32 >(val4);
  ecode5 = SWIG_AsVal_unsigned_SS_int(obj4, &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "_SparseMatrix32_getSlice" "', argument " "5"" of type '" "nupic::UInt32""'");
  } 
  arg5 = static_cast< nupic::UInt32 >(val5);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__getSlice((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > const *)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((new nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >(static_cast< const nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >& >(result))), SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_getSlice2__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  nupic::UInt32 arg3 ;
  nupic::UInt32 arg4 ;
  nupic::UInt32 arg5 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  unsigned int val5 ;
  int ecode5 = 0 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > result;
  
  if ((nobjs < 5) || (nobjs > 5)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_getSlice2" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_getSlice2" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_getSlice2" "', argument " "3"" of type '" "nupic::UInt32""'");
  } 
  arg3 = static_cast< nupic::UInt32 >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_getSlice2" "', argument " "4"" of type '" "nupic::UInt32""'");
  } 
  arg4 = static_cast< nupic::UInt32 >(val4);
  ecode5 = SWIG_AsVal_unsigned_SS_int(swig_obj[4], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "_SparseMatrix32_getSlice2" "', argument " "5"" of type '" "nupic::UInt32""'");
  } 
  arg5 = static_cast< nupic::UInt32 >(val5);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__getSlice2__SWIG_1((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > const *)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((new nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >(static_cast< const nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >& >(result))), SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_getSlice2(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[7];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SparseMatrix32_getSlice2",0,6,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_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;
      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_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 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;
      {
        {
          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;
      {
        {
          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;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[5], &vptr, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_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__SparseMatrix32_getSlice2__SWIG_1(self, argc, argv);
    case 2:
      return _wrap__SparseMatrix32_getSlice2__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SparseMatrix32_getSlice2'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::getSlice2(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &) const\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::getSlice2(nupic::UInt32,nupic::UInt32,nupic::UInt32,nupic::UInt32) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_setRowsToZero(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_rows", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_setRowsToZero",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_setRowsToZero" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__setRowsToZero(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__SparseMatrix32_setColsToZero(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_cols", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_setColsToZero",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_setColsToZero" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__setColsToZero(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__SparseMatrix32_setDiagonal(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_v", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_setDiagonal",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_setDiagonal" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__setDiagonal(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__SparseMatrix32_incrementOnOuterWNZ(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  nupic::Real32 arg4 = (nupic::Real32) 1 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  float val4 ;
  int ecode4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_i",(char *) "py_j",(char *) "delta", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:_SparseMatrix32_incrementOnOuterWNZ",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_incrementOnOuterWNZ" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  arg3 = obj2;
  if (obj3) {
    ecode4 = SWIG_AsVal_float(obj3, &val4);
    if (!SWIG_IsOK(ecode4)) {
      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_incrementOnOuterWNZ" "', argument " "4"" of type '" "nupic::Real32""'");
    } 
    arg4 = static_cast< nupic::Real32 >(val4);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__incrementOnOuterWNZ(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__SparseMatrix32_incrementOnOuterWNZWThreshold(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  nupic::Real32 arg4 ;
  nupic::Real32 arg5 = (nupic::Real32) 1 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  float val4 ;
  int ecode4 = 0 ;
  float val5 ;
  int ecode5 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_i",(char *) "py_j",(char *) "threshold",(char *) "delta", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO|O:_SparseMatrix32_incrementOnOuterWNZWThreshold",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_incrementOnOuterWNZWThreshold" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  arg3 = obj2;
  ecode4 = SWIG_AsVal_float(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_incrementOnOuterWNZWThreshold" "', argument " "4"" of type '" "nupic::Real32""'");
  } 
  arg4 = static_cast< nupic::Real32 >(val4);
  if (obj4) {
    ecode5 = SWIG_AsVal_float(obj4, &val5);
    if (!SWIG_IsOK(ecode5)) {
      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "_SparseMatrix32_incrementOnOuterWNZWThreshold" "', argument " "5"" of type '" "nupic::Real32""'");
    } 
    arg5 = static_cast< nupic::Real32 >(val5);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__incrementOnOuterWNZWThreshold(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__SparseMatrix32_nNonZerosPerRow(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_nNonZerosPerRow" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__nNonZerosPerRow((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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__SparseMatrix32_nNonZerosPerCol(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_nNonZerosPerCol" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__nNonZerosPerCol((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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__SparseMatrix32_rowBandwidths(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rowBandwidths" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rowBandwidths((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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__SparseMatrix32_colBandwidths(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_colBandwidths" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__colBandwidths((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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__SparseMatrix32_nNonZerosPerBox(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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 *) "box_i",(char *) "box_j", NULL 
  };
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SparseMatrix32_nNonZerosPerBox",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_nNonZerosPerBox" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__nNonZerosPerBox((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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((new nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >(static_cast< const nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >& >(result))), SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_max__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_max" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__max__SWIG_1((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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__SparseMatrix32_max(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SparseMatrix32_max",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_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_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 == 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 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_unsigned_int, 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_unsigned_int, 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[3], &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__SparseMatrix32_max__SWIG_1(self, argc, argv);
    case 2:
      return _wrap__SparseMatrix32_max__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SparseMatrix32_max'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::max(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type &) const\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::max() const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_min__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_min" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__min__SWIG_1((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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__SparseMatrix32_min(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SparseMatrix32_min",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_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_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 == 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 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_unsigned_int, 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_unsigned_int, 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[3], &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__SparseMatrix32_min__SWIG_1(self, argc, argv);
    case 2:
      return _wrap__SparseMatrix32_min__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SparseMatrix32_min'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::min(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type &) const\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::min() const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_rowMin__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rowMin" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_rowMin" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rowMin__SWIG_3((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_rowMax__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rowMax" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_rowMax" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rowMax__SWIG_3((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_colMin__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_colMin" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_colMin" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__colMin__SWIG_3((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_colMax__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_colMax" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_colMax" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__colMax__SWIG_3((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_rowMax__SWIG_4(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rowMax" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rowMax__SWIG_4((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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__SparseMatrix32_rowMax(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SparseMatrix32_rowMax",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_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 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;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
    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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0);
        _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;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_unsigned_int, 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[3], &vptr, SWIGTYPE_p_float, 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__SparseMatrix32_rowMax__SWIG_4(self, argc, argv);
    case 2:
      return _wrap__SparseMatrix32_rowMax__SWIG_3(self, argc, argv);
    case 3:
      return _wrap__SparseMatrix32_rowMax__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SparseMatrix32_rowMax'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::rowMax(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type &) const\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::rowMax(nupic::UInt32) const\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::rowMax() const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_rowMin__SWIG_4(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rowMin" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rowMin__SWIG_4((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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__SparseMatrix32_rowMin(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SparseMatrix32_rowMin",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_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 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;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
    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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0);
        _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;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_unsigned_int, 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[3], &vptr, SWIGTYPE_p_float, 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__SparseMatrix32_rowMin__SWIG_4(self, argc, argv);
    case 2:
      return _wrap__SparseMatrix32_rowMin__SWIG_3(self, argc, argv);
    case 3:
      return _wrap__SparseMatrix32_rowMin__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SparseMatrix32_rowMin'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::rowMin(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type &) const\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::rowMin(nupic::UInt32) const\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::rowMin() const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_colMax__SWIG_4(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_colMax" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__colMax__SWIG_4((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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__SparseMatrix32_colMax(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SparseMatrix32_colMax",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_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 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;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
    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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0);
        _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;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_unsigned_int, 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[3], &vptr, SWIGTYPE_p_float, 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__SparseMatrix32_colMax__SWIG_4(self, argc, argv);
    case 2:
      return _wrap__SparseMatrix32_colMax__SWIG_3(self, argc, argv);
    case 3:
      return _wrap__SparseMatrix32_colMax__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SparseMatrix32_colMax'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::colMax(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type &) const\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::colMax(nupic::UInt32) const\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::colMax() const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_colMin__SWIG_4(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_colMin" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__colMin__SWIG_4((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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__SparseMatrix32_colMin(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SparseMatrix32_colMin",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_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 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;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
    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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0);
        _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;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_unsigned_int, 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[3], &vptr, SWIGTYPE_p_float, 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__SparseMatrix32_colMin__SWIG_4(self, argc, argv);
    case 2:
      return _wrap__SparseMatrix32_colMin__SWIG_3(self, argc, argv);
    case 3:
      return _wrap__SparseMatrix32_colMin__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SparseMatrix32_colMin'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::colMin(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type &) const\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::colMin(nupic::UInt32) const\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::colMin() const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_boxMin__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  nupic::UInt32 arg3 ;
  nupic::UInt32 arg4 ;
  nupic::UInt32 arg5 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  unsigned int val5 ;
  int ecode5 = 0 ;
  PyObject *result = 0 ;
  
  if ((nobjs < 5) || (nobjs > 5)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_boxMin" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_boxMin" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_boxMin" "', argument " "3"" of type '" "nupic::UInt32""'");
  } 
  arg3 = static_cast< nupic::UInt32 >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_boxMin" "', argument " "4"" of type '" "nupic::UInt32""'");
  } 
  arg4 = static_cast< nupic::UInt32 >(val4);
  ecode5 = SWIG_AsVal_unsigned_SS_int(swig_obj[4], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "_SparseMatrix32_boxMin" "', argument " "5"" of type '" "nupic::UInt32""'");
  } 
  arg5 = static_cast< nupic::UInt32 >(val5);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__boxMin__SWIG_1((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > const *)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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_boxMin(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[9];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SparseMatrix32_boxMin",0,8,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_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;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 8) {
      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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 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;
      {
        {
          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;
      {
        {
          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;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[5], &vptr, SWIGTYPE_p_unsigned_int, 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_unsigned_int, 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[7], &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__SparseMatrix32_boxMin__SWIG_1(self, argc, argv);
    case 2:
      return _wrap__SparseMatrix32_boxMin__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SparseMatrix32_boxMin'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::boxMin(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type &) const\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::boxMin(nupic::UInt32,nupic::UInt32,nupic::UInt32,nupic::UInt32) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_boxMax__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  nupic::UInt32 arg3 ;
  nupic::UInt32 arg4 ;
  nupic::UInt32 arg5 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  unsigned int val5 ;
  int ecode5 = 0 ;
  PyObject *result = 0 ;
  
  if ((nobjs < 5) || (nobjs > 5)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_boxMax" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_boxMax" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_boxMax" "', argument " "3"" of type '" "nupic::UInt32""'");
  } 
  arg3 = static_cast< nupic::UInt32 >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_boxMax" "', argument " "4"" of type '" "nupic::UInt32""'");
  } 
  arg4 = static_cast< nupic::UInt32 >(val4);
  ecode5 = SWIG_AsVal_unsigned_SS_int(swig_obj[4], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "_SparseMatrix32_boxMax" "', argument " "5"" of type '" "nupic::UInt32""'");
  } 
  arg5 = static_cast< nupic::UInt32 >(val5);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__boxMax__SWIG_1((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > const *)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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_boxMax(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[9];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SparseMatrix32_boxMax",0,8,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_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;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 8) {
      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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 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;
      {
        {
          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;
      {
        {
          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;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[5], &vptr, SWIGTYPE_p_unsigned_int, 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_unsigned_int, 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[7], &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__SparseMatrix32_boxMax__SWIG_1(self, argc, argv);
    case 2:
      return _wrap__SparseMatrix32_boxMax__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SparseMatrix32_boxMax'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::boxMax(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type &,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type &) const\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::boxMax(nupic::UInt32,nupic::UInt32,nupic::UInt32,nupic::UInt32) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_whereEqual(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  nupic::UInt32 arg3 ;
  nupic::UInt32 arg4 ;
  nupic::UInt32 arg5 ;
  nupic::Real32 *arg6 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  unsigned int val5 ;
  int ecode5 = 0 ;
  nupic::Real32 temp6 ;
  float 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 *) "begin_row",(char *) "end_row",(char *) "begin_col",(char *) "end_col",(char *) "value", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOOO:_SparseMatrix32_whereEqual",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_whereEqual" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_whereEqual" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_whereEqual" "', argument " "3"" of type '" "nupic::UInt32""'");
  } 
  arg3 = static_cast< nupic::UInt32 >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_whereEqual" "', argument " "4"" of type '" "nupic::UInt32""'");
  } 
  arg4 = static_cast< nupic::UInt32 >(val4);
  ecode5 = SWIG_AsVal_unsigned_SS_int(obj4, &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "_SparseMatrix32_whereEqual" "', argument " "5"" of type '" "nupic::UInt32""'");
  } 
  arg5 = static_cast< nupic::UInt32 >(val5);
  ecode6 = SWIG_AsVal_float(obj5, &val6);
  if (!SWIG_IsOK(ecode6)) {
    SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "_SparseMatrix32_whereEqual" "', argument " "6"" of type '" "nupic::Real32""'");
  } 
  temp6 = static_cast< nupic::Real32 >(val6);
  arg6 = &temp6;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__whereEqual((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > const *)arg1,arg2,arg3,arg4,arg5,(float const &)*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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_whereGreater(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  nupic::UInt32 arg3 ;
  nupic::UInt32 arg4 ;
  nupic::UInt32 arg5 ;
  nupic::Real32 *arg6 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  unsigned int val5 ;
  int ecode5 = 0 ;
  nupic::Real32 temp6 ;
  float 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 *) "begin_row",(char *) "end_row",(char *) "begin_col",(char *) "end_col",(char *) "value", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOOO:_SparseMatrix32_whereGreater",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_whereGreater" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_whereGreater" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_whereGreater" "', argument " "3"" of type '" "nupic::UInt32""'");
  } 
  arg3 = static_cast< nupic::UInt32 >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_whereGreater" "', argument " "4"" of type '" "nupic::UInt32""'");
  } 
  arg4 = static_cast< nupic::UInt32 >(val4);
  ecode5 = SWIG_AsVal_unsigned_SS_int(obj4, &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "_SparseMatrix32_whereGreater" "', argument " "5"" of type '" "nupic::UInt32""'");
  } 
  arg5 = static_cast< nupic::UInt32 >(val5);
  ecode6 = SWIG_AsVal_float(obj5, &val6);
  if (!SWIG_IsOK(ecode6)) {
    SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "_SparseMatrix32_whereGreater" "', argument " "6"" of type '" "nupic::Real32""'");
  } 
  temp6 = static_cast< nupic::Real32 >(val6);
  arg6 = &temp6;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__whereGreater((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > const *)arg1,arg2,arg3,arg4,arg5,(float const &)*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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_whereGreaterEqual(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  nupic::UInt32 arg3 ;
  nupic::UInt32 arg4 ;
  nupic::UInt32 arg5 ;
  nupic::Real32 *arg6 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  unsigned int val5 ;
  int ecode5 = 0 ;
  nupic::Real32 temp6 ;
  float 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 *) "begin_row",(char *) "end_row",(char *) "begin_col",(char *) "end_col",(char *) "value", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOOO:_SparseMatrix32_whereGreaterEqual",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_whereGreaterEqual" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_whereGreaterEqual" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_whereGreaterEqual" "', argument " "3"" of type '" "nupic::UInt32""'");
  } 
  arg3 = static_cast< nupic::UInt32 >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_whereGreaterEqual" "', argument " "4"" of type '" "nupic::UInt32""'");
  } 
  arg4 = static_cast< nupic::UInt32 >(val4);
  ecode5 = SWIG_AsVal_unsigned_SS_int(obj4, &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "_SparseMatrix32_whereGreaterEqual" "', argument " "5"" of type '" "nupic::UInt32""'");
  } 
  arg5 = static_cast< nupic::UInt32 >(val5);
  ecode6 = SWIG_AsVal_float(obj5, &val6);
  if (!SWIG_IsOK(ecode6)) {
    SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "_SparseMatrix32_whereGreaterEqual" "', argument " "6"" of type '" "nupic::Real32""'");
  } 
  temp6 = static_cast< nupic::Real32 >(val6);
  arg6 = &temp6;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__whereGreaterEqual((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > const *)arg1,arg2,arg3,arg4,arg5,(float const &)*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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_countWhereGreaterOrEqual(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  nupic::UInt32 arg3 ;
  nupic::UInt32 arg4 ;
  nupic::UInt32 arg5 ;
  nupic::Real32 *arg6 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  unsigned int val5 ;
  int ecode5 = 0 ;
  nupic::Real32 temp6 ;
  float 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 *) "begin_row",(char *) "end_row",(char *) "begin_col",(char *) "end_col",(char *) "value", NULL 
  };
  nupic::UInt32 result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOOO:_SparseMatrix32_countWhereGreaterOrEqual",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_countWhereGreaterOrEqual" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_countWhereGreaterOrEqual" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_countWhereGreaterOrEqual" "', argument " "3"" of type '" "nupic::UInt32""'");
  } 
  arg3 = static_cast< nupic::UInt32 >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_countWhereGreaterOrEqual" "', argument " "4"" of type '" "nupic::UInt32""'");
  } 
  arg4 = static_cast< nupic::UInt32 >(val4);
  ecode5 = SWIG_AsVal_unsigned_SS_int(obj4, &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "_SparseMatrix32_countWhereGreaterOrEqual" "', argument " "5"" of type '" "nupic::UInt32""'");
  } 
  arg5 = static_cast< nupic::UInt32 >(val5);
  ecode6 = SWIG_AsVal_float(obj5, &val6);
  if (!SWIG_IsOK(ecode6)) {
    SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "_SparseMatrix32_countWhereGreaterOrEqual" "', argument " "6"" of type '" "nupic::Real32""'");
  } 
  temp6 = static_cast< nupic::Real32 >(val6);
  arg6 = &temp6;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt32)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__countWhereGreaterOrEqual((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > const *)arg1,arg2,arg3,arg4,arg5,(float const &)*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__SparseMatrix32_permuteRows(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_permutation", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_permuteRows",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_permuteRows" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__permuteRows(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__SparseMatrix32_permuteCols(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_permutation", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_permuteCols",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_permuteCols" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__permuteCols(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__SparseMatrix32_rowSums__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rowSums" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rowSums__SWIG_2((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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__SparseMatrix32_rowSums(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SparseMatrix32_rowSums",0,2,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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 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__SparseMatrix32_rowSums__SWIG_2(self, argc, argv);
    case 2:
      return _wrap__SparseMatrix32_rowSums__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SparseMatrix32_rowSums'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::rowSums(std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > &) const\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::rowSums() const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_colSums(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_colSums" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__colSums((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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__SparseMatrix32_addRows(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "whichRows", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_addRows",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_addRows" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__addRows((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_addListOfRows(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_whichRows", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_addListOfRows",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_addListOfRows" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__addListOfRows((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_rowProds(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rowProds" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rowProds((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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__SparseMatrix32_colProds(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_colProds" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__colProds((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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__SparseMatrix32_logRowSums(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_logRowSums" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__logRowSums((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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__SparseMatrix32_logColSums(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_logColSums" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__logColSums((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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__SparseMatrix32_scaleRows(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_s", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_scaleRows",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_scaleRows" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__scaleRows(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__SparseMatrix32_scaleCols(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_s", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_scaleCols",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_scaleCols" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__scaleCols(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__SparseMatrix32_normalizeBlockByRows(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  nupic::Real32 arg3 = (nupic::Real32) -1.0 ;
  nupic::Real32 arg4 = (nupic::Real32) 1e-6 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  float val3 ;
  int ecode3 = 0 ;
  float val4 ;
  int ecode4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_inds",(char *) "val",(char *) "eps_n", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|OO:_SparseMatrix32_normalizeBlockByRows",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_normalizeBlockByRows" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  if (obj2) {
    ecode3 = SWIG_AsVal_float(obj2, &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_normalizeBlockByRows" "', argument " "3"" of type '" "nupic::Real32""'");
    } 
    arg3 = static_cast< nupic::Real32 >(val3);
  }
  if (obj3) {
    ecode4 = SWIG_AsVal_float(obj3, &val4);
    if (!SWIG_IsOK(ecode4)) {
      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_normalizeBlockByRows" "', argument " "4"" of type '" "nupic::Real32""'");
    } 
    arg4 = static_cast< nupic::Real32 >(val4);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__normalizeBlockByRows(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__SparseMatrix32_normalizeBlockByRows_binary(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  nupic::Real32 arg3 = (nupic::Real32) -1.0 ;
  nupic::Real32 arg4 = (nupic::Real32) 1e-6 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  float val3 ;
  int ecode3 = 0 ;
  float val4 ;
  int ecode4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_inds",(char *) "val",(char *) "eps_n", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|OO:_SparseMatrix32_normalizeBlockByRows_binary",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_normalizeBlockByRows_binary" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  if (obj2) {
    ecode3 = SWIG_AsVal_float(obj2, &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_normalizeBlockByRows_binary" "', argument " "3"" of type '" "nupic::Real32""'");
    } 
    arg3 = static_cast< nupic::Real32 >(val3);
  }
  if (obj3) {
    ecode4 = SWIG_AsVal_float(obj3, &val4);
    if (!SWIG_IsOK(ecode4)) {
      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_normalizeBlockByRows_binary" "', argument " "4"" of type '" "nupic::Real32""'");
    } 
    arg4 = static_cast< nupic::Real32 >(val4);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__normalizeBlockByRows_binary(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__SparseMatrix32_axby__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  nupic::Real32 arg3 ;
  nupic::Real32 arg4 ;
  PyObject *arg5 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  float val3 ;
  int ecode3 = 0 ;
  float val4 ;
  int ecode4 = 0 ;
  
  if ((nobjs < 5) || (nobjs > 5)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_axby" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_axby" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  ecode3 = SWIG_AsVal_float(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_axby" "', argument " "3"" of type '" "nupic::Real32""'");
  } 
  arg3 = static_cast< nupic::Real32 >(val3);
  ecode4 = SWIG_AsVal_float(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_axby" "', argument " "4"" of type '" "nupic::Real32""'");
  } 
  arg4 = static_cast< nupic::Real32 >(val4);
  arg5 = swig_obj[4];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__axby__SWIG_2(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__SparseMatrix32_axby__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::Real32 arg2 ;
  nupic::Real32 arg3 ;
  PyObject *arg4 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  float val2 ;
  int ecode2 = 0 ;
  float val3 ;
  int ecode3 = 0 ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_axby" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_float(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_axby" "', argument " "2"" of type '" "nupic::Real32""'");
  } 
  arg2 = static_cast< nupic::Real32 >(val2);
  ecode3 = SWIG_AsVal_float(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_axby" "', argument " "3"" of type '" "nupic::Real32""'");
  } 
  arg3 = static_cast< nupic::Real32 >(val3);
  arg4 = swig_obj[3];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__axby__SWIG_3(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__SparseMatrix32_axby(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[6];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SparseMatrix32_axby",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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_float(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_float(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[3] != 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 == 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 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;
      {
        {
          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;
      {
        {
          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;
      {
        _v = (argv[4] != 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__SparseMatrix32_axby__SWIG_3(self, argc, argv);
    case 2:
      return _wrap__SparseMatrix32_axby__SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SparseMatrix32_axby'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::axby(nupic::UInt32,nupic::Real32,nupic::Real32,PyObject *)\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::axby(nupic::Real32,nupic::Real32,PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_rightVecProd__SWIG_5(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  nupic::Real32 result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rightVecProd" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_rightVecProd" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  arg3 = swig_obj[2];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real32)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rightVecProd__SWIG_5((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_rightVecProd__SWIG_6(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rightVecProd" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = swig_obj[1];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rightVecProd__SWIG_6((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_rightVecProd_fast(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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 *) "xIn",(char *) "yOut", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SparseMatrix32_rightVecProd_fast",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rightVecProd_fast" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rightVecProd_fast((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_rightVecProd__SWIG_7(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *result = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rightVecProd" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = swig_obj[1];
  arg3 = swig_obj[2];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rightVecProd__SWIG_7((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_rightVecProd(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SparseMatrix32_rightVecProd",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_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 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;
      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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 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;
      {
        int res = swig::asptr(argv[2], (std::vector<float,std::allocator< 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:
    
    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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0);
        _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;
      {
        _v = (argv[2] != 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:
    
    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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_4;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = swig::asptr(argv[1], (std::vector<float,std::allocator< float > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_4;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, 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:
    
    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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_5;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[1] != 0);
      }
      if (!_v) goto check_5;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[2] != 0);
      }
      if (!_v) goto check_5;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 5;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_5:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap__SparseMatrix32_rightVecProd__SWIG_6(self, argc, argv);
    case 2:
      return _wrap__SparseMatrix32_rightVecProd__SWIG_3(self, argc, argv);
    case 3:
      return _wrap__SparseMatrix32_rightVecProd__SWIG_5(self, argc, argv);
    case 4:
      return _wrap__SparseMatrix32_rightVecProd__SWIG_4(self, argc, argv);
    case 5:
      return _wrap__SparseMatrix32_rightVecProd__SWIG_7(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SparseMatrix32_rightVecProd'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::rightVecProd(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &) const\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::rightVecProd(std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &,std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > &) const\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::rightVecProd(nupic::UInt32,PyObject *) const\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::rightVecProd(PyObject *) const\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::rightVecProd(PyObject *,PyObject *) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_blockRightVecProd(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "block_size",(char *) "xIn", NULL 
  };
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SparseMatrix32_blockRightVecProd",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_blockRightVecProd" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_blockRightVecProd" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__blockRightVecProd((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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((new nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >(static_cast< const nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >& >(result))), SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_leftVecProd__SWIG_5(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  nupic::Real32 result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_leftVecProd" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_leftVecProd" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  arg3 = swig_obj[2];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real32)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__leftVecProd__SWIG_5((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_leftVecProd__SWIG_6(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_leftVecProd" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = swig_obj[1];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__leftVecProd__SWIG_6((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_leftVecProd__SWIG_7(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *result = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_leftVecProd" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = swig_obj[1];
  arg3 = swig_obj[2];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__leftVecProd__SWIG_7((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_leftVecProd(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SparseMatrix32_leftVecProd",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_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 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;
      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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 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;
      {
        int res = swig::asptr(argv[2], (std::vector<float,std::allocator< 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:
    
    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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0);
        _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;
      {
        _v = (argv[2] != 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:
    
    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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_4;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = swig::asptr(argv[1], (std::vector<float,std::allocator< float > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_4;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, 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:
    
    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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_5;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[1] != 0);
      }
      if (!_v) goto check_5;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[2] != 0);
      }
      if (!_v) goto check_5;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 5;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_5:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap__SparseMatrix32_leftVecProd__SWIG_6(self, argc, argv);
    case 2:
      return _wrap__SparseMatrix32_leftVecProd__SWIG_3(self, argc, argv);
    case 3:
      return _wrap__SparseMatrix32_leftVecProd__SWIG_5(self, argc, argv);
    case 4:
      return _wrap__SparseMatrix32_leftVecProd__SWIG_4(self, argc, argv);
    case 5:
      return _wrap__SparseMatrix32_leftVecProd__SWIG_7(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SparseMatrix32_leftVecProd'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::leftVecProd(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &) const\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::leftVecProd(std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &,std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > &) const\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::leftVecProd(nupic::UInt32,PyObject *) const\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::leftVecProd(PyObject *) const\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::leftVecProd(PyObject *,PyObject *) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_leftVecProd_binary(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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 *) "pyCols",(char *) "xIn", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SparseMatrix32_leftVecProd_binary",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_leftVecProd_binary" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__leftVecProd_binary((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_rightDenseMatProd(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "mIn", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_rightDenseMatProd",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rightDenseMatProd" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rightDenseMatProd((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_rightDenseMatProdAtNZ(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "mIn", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_rightDenseMatProdAtNZ",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rightDenseMatProdAtNZ" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rightDenseMatProdAtNZ((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_denseMatExtract(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "mIn", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_denseMatExtract",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_denseMatExtract" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__denseMatExtract((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_leftDenseMatProd(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "mIn", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_leftDenseMatProd",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_leftDenseMatProd" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__leftDenseMatProd((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_elementRowAdd(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "xIn", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SparseMatrix32_elementRowAdd",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementRowAdd" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementRowAdd" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__elementRowAdd(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__SparseMatrix32_elementRowSubtract(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "xIn", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SparseMatrix32_elementRowSubtract",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementRowSubtract" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementRowSubtract" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__elementRowSubtract(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__SparseMatrix32_elementRowMultiply__SWIG_4(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementRowMultiply" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementRowMultiply" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  arg3 = swig_obj[2];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__elementRowMultiply__SWIG_4(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__SparseMatrix32_elementRowMultiply(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SparseMatrix32_elementRowMultiply",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_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_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_float(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_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 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:
    
    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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0);
        _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::asptr(argv[2], (std::vector<float,std::allocator< float > >**)(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[3], &vptr, SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_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:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap__SparseMatrix32_elementRowMultiply__SWIG_0(self, argc, argv);
    case 2:
      return _wrap__SparseMatrix32_elementRowMultiply__SWIG_4(self, argc, argv);
    case 3:
      return _wrap__SparseMatrix32_elementRowMultiply__SWIG_3(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SparseMatrix32_elementRowMultiply'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::elementRowMultiply(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type const &)\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::elementRowMultiply(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &,std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > &) const\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::elementRowMultiply(nupic::UInt32,PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_elementRowDivide__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementRowDivide" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementRowDivide" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  arg3 = swig_obj[2];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__elementRowDivide__SWIG_2(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__SparseMatrix32_elementRowDivide(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SparseMatrix32_elementRowDivide",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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_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_float(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_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 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__SparseMatrix32_elementRowDivide__SWIG_0(self, argc, argv);
    case 2:
      return _wrap__SparseMatrix32_elementRowDivide__SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SparseMatrix32_elementRowDivide'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::elementRowDivide(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type const &)\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::elementRowDivide(nupic::UInt32,PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_elementColAdd(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "xIn", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SparseMatrix32_elementColAdd",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementColAdd" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementColAdd" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__elementColAdd(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__SparseMatrix32_elementColSubtract(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "xIn", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SparseMatrix32_elementColSubtract",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementColSubtract" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementColSubtract" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__elementColSubtract(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__SparseMatrix32_elementColMultiply__SWIG_4(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementColMultiply" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementColMultiply" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  arg3 = swig_obj[2];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__elementColMultiply__SWIG_4(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__SparseMatrix32_elementColMultiply(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SparseMatrix32_elementColMultiply",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_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_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_float(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_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 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:
    
    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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0);
        _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::asptr(argv[2], (std::vector<float,std::allocator< float > >**)(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[3], &vptr, SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_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:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap__SparseMatrix32_elementColMultiply__SWIG_0(self, argc, argv);
    case 2:
      return _wrap__SparseMatrix32_elementColMultiply__SWIG_4(self, argc, argv);
    case 3:
      return _wrap__SparseMatrix32_elementColMultiply__SWIG_3(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SparseMatrix32_elementColMultiply'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::elementColMultiply(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type const &)\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::elementColMultiply(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > const &,std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > &) const\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::elementColMultiply(nupic::UInt32,PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_elementColDivide__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::UInt32 arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementColDivide" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_elementColDivide" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  arg3 = swig_obj[2];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__elementColDivide__SWIG_2(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__SparseMatrix32_elementColDivide(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SparseMatrix32_elementColDivide",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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_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_float(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_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 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__SparseMatrix32_elementColDivide__SWIG_0(self, argc, argv);
    case 2:
      return _wrap__SparseMatrix32_elementColDivide__SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SparseMatrix32_elementColDivide'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::elementColDivide(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type,nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type const &)\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::elementColDivide(nupic::UInt32,PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_elementMultiply__SWIG_4(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_elementMultiply" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = swig_obj[1];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__elementMultiply__SWIG_4(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__SparseMatrix32_elementMultiply(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SparseMatrix32_elementMultiply",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_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 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;
      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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 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:
    
    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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_4;
      _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_4;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 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:
    
    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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_5;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_5;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_5;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 5;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_5:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap__SparseMatrix32_elementMultiply__SWIG_0(self, argc, argv);
    case 2:
      return _wrap__SparseMatrix32_elementMultiply__SWIG_2(self, argc, argv);
    case 3:
      return _wrap__SparseMatrix32_elementMultiply__SWIG_4(self, argc, argv);
    case 4:
      return _wrap__SparseMatrix32_elementMultiply__SWIG_3(self, argc, argv);
    case 5:
      return _wrap__SparseMatrix32_elementMultiply__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SparseMatrix32_elementMultiply'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::elementMultiply(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &)\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::elementMultiply(nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &,nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &) const\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::elementMultiply(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *)\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::elementMultiply(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *,nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &) const\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::elementMultiply(PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_rightVecProdAtNZ(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "xIn", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_rightVecProdAtNZ",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rightVecProdAtNZ" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rightVecProdAtNZ((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_leftVecProdAtNZ(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "xIn", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_leftVecProdAtNZ",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_leftVecProdAtNZ" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__leftVecProdAtNZ((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_rightVecSumAtNZ(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "xIn", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_rightVecSumAtNZ",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rightVecSumAtNZ" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rightVecSumAtNZ((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_rightVecSumAtNZGtThreshold(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  nupic::Real32 arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  float val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "xIn",(char *) "threshold", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SparseMatrix32_rightVecSumAtNZGtThreshold",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rightVecSumAtNZGtThreshold" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  ecode3 = SWIG_AsVal_float(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_rightVecSumAtNZGtThreshold" "', argument " "3"" of type '" "nupic::Real32""'");
  } 
  arg3 = static_cast< nupic::Real32 >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rightVecSumAtNZGtThreshold((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_rightVecSumAtNZ_fast(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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 *) "xIn",(char *) "yOut", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SparseMatrix32_rightVecSumAtNZ_fast",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rightVecSumAtNZ_fast" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rightVecSumAtNZ_fast((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_leftVecSumAtNZ(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "xIn", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_leftVecSumAtNZ",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_leftVecSumAtNZ" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__leftVecSumAtNZ((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_leftVecSumAtNZ_fast(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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 *) "xIn",(char *) "yOut", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SparseMatrix32_leftVecSumAtNZ_fast",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_leftVecSumAtNZ_fast" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__leftVecSumAtNZ_fast((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_rightVecSumAtNZGtThreshold_fast(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  nupic::Real32 arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  float val4 ;
  int ecode4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "xIn",(char *) "yOut",(char *) "threshold", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:_SparseMatrix32_rightVecSumAtNZGtThreshold_fast",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rightVecSumAtNZGtThreshold_fast" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  arg3 = obj2;
  ecode4 = SWIG_AsVal_float(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SparseMatrix32_rightVecSumAtNZGtThreshold_fast" "', argument " "4"" of type '" "nupic::Real32""'");
  } 
  arg4 = static_cast< nupic::Real32 >(val4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rightVecSumAtNZGtThreshold_fast((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_leftDenseMatProdAtNZ(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "mIn", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_leftDenseMatProdAtNZ",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_leftDenseMatProdAtNZ" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__leftDenseMatProdAtNZ((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_rightDenseMatSumAtNZ(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "mIn", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_rightDenseMatSumAtNZ",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rightDenseMatSumAtNZ" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rightDenseMatSumAtNZ((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_leftDenseMatSumAtNZ(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "mIn", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_leftDenseMatSumAtNZ",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_leftDenseMatSumAtNZ" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__leftDenseMatSumAtNZ((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_rightDenseMatMaxAtNZ(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "mIn", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_rightDenseMatMaxAtNZ",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rightDenseMatMaxAtNZ" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rightDenseMatMaxAtNZ((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_leftDenseMatMaxAtNZ(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "mIn", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_leftDenseMatMaxAtNZ",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_leftDenseMatMaxAtNZ" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__leftDenseMatMaxAtNZ((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_vecArgMaxAtNZ(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "xIn", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_vecArgMaxAtNZ",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_vecArgMaxAtNZ" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__vecArgMaxAtNZ(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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_vecMaxAtNZ(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "xIn", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_vecMaxAtNZ",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_vecMaxAtNZ" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__vecMaxAtNZ(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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_rowVecProd(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  nupic::Real32 arg3 = (nupic::Real32) nupic::Epsilon ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  float val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "xIn",(char *) "lb", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|O:_SparseMatrix32_rowVecProd",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_rowVecProd" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  if (obj2) {
    ecode3 = SWIG_AsVal_float(obj2, &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_rowVecProd" "', argument " "3"" of type '" "nupic::Real32""'");
    } 
    arg3 = static_cast< nupic::Real32 >(val3);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__rowVecProd((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_vecMaxProd(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "xIn", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_vecMaxProd",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_vecMaxProd" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__vecMaxProd(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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_vecArgMaxProd(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "xIn", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_vecArgMaxProd",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_vecArgMaxProd" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__vecArgMaxProd(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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_getNonZerosSorted(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::Int arg2 = (nupic::Int) -1 ;
  bool arg3 = (bool) true ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  bool val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "n",(char *) "ascending_values", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OO:_SparseMatrix32_getNonZerosSorted",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_getNonZerosSorted" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  if (obj1) {
    ecode2 = SWIG_AsVal_int(obj1, &val2);
    if (!SWIG_IsOK(ecode2)) {
      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_getNonZerosSorted" "', argument " "2"" of type '" "nupic::Int""'");
    } 
    arg2 = static_cast< nupic::Int >(val2);
  }
  if (obj2) {
    ecode3 = SWIG_AsVal_bool(obj2, &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_getNonZerosSorted" "', 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 = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__getNonZerosSorted((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_threshold__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::Real32 arg2 ;
  bool arg3 = (bool) false ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  float val2 ;
  int ecode2 = 0 ;
  bool val3 ;
  int ecode3 = 0 ;
  PyObject *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_threshold" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_float(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SparseMatrix32_threshold" "', argument " "2"" of type '" "nupic::Real32""'");
  } 
  arg2 = static_cast< nupic::Real32 >(val2);
  if (swig_obj[2]) {
    ecode3 = SWIG_AsVal_bool(swig_obj[2], &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SparseMatrix32_threshold" "', 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 = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__threshold__SWIG_2(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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_threshold(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SparseMatrix32_threshold",0,3,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if ((argc >= 1) && (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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (argc > 1) {
        {
          {
            int res = SWIG_AsVal_float(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 >= 2) && (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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0);
        _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;
      if (argc > 2) {
        {
          {
            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;
      }
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap__SparseMatrix32_threshold__SWIG_0(self, argc, argv);
    case 2:
      return _wrap__SparseMatrix32_threshold__SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SparseMatrix32_threshold'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::threshold(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type const &)\n"
    "    nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::threshold(nupic::Real32,bool)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32_toPyString(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_toPyString" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__toPyString((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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__SparseMatrix32_fromPyString(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "s", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SparseMatrix32_fromPyString",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32_fromPyString" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__fromPyString(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_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32___eq__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *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:_SparseMatrix32___eq__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32___eq__" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SparseMatrix32___eq__" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32___eq__" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg____eq__((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > const *)arg1,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SparseMatrix32___ne__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = (nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *) 0 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *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:_SparseMatrix32___ne__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SparseMatrix32___ne__" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SparseMatrix32___ne__" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SparseMatrix32___ne__" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg____ne__((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > const *)arg1,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_SparseMatrix32_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__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new__SM_01_32_32__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *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::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *)new nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new__SM_01_32_32__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::istream *arg1 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *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__SM_01_32_32" "', argument " "1"" of type '" "std::istream &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new__SM_01_32_32" "', 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::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *)new nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 >(*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__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new__SM_01_32_32__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type arg1 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  ecode1 = SWIG_AsVal_unsigned_SS_int(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new__SM_01_32_32" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type""'");
  } 
  arg1 = static_cast< nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type >(val1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *)new nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 >(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__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new__SM_01_32_32__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type arg1 ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type arg2 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  ecode1 = SWIG_AsVal_unsigned_SS_int(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new__SM_01_32_32" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type""'");
  } 
  arg1 = static_cast< nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type >(val1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new__SM_01_32_32" "', argument " "2"" of type '" "nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *)new nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 >(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__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new__SM_01_32_32__SWIG_4(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t,  0  | 0);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new__SM_01_32_32" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new__SM_01_32_32" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const &""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *)new nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 >((nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > 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__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new__SM_01_32_32(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new__SM_01_32_32",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;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__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:
    
    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__SparseBinaryMatrixT_unsigned_int_unsigned_int_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 == 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_4;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 4;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_4:
    
    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_5;
      _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_5;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 5;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_5:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_new__SM_01_32_32__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new__SM_01_32_32__SWIG_1(self, argc, argv);
    case 3:
      return _wrap_new__SM_01_32_32__SWIG_4(self, argc, argv);
    case 4:
      return _wrap_new__SM_01_32_32__SWIG_2(self, argc, argv);
    case 5:
      return _wrap_new__SM_01_32_32__SWIG_3(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new__SM_01_32_32'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 >::SparseBinaryMatrix()\n"
    "    nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 >::SparseBinaryMatrix(std::istream &)\n"
    "    nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 >::SparseBinaryMatrix(nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type)\n"
    "    nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 >::SparseBinaryMatrix(nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type,nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type)\n"
    "    nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 >::SparseBinaryMatrix(nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_copy(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *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 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SM_01_32_32_copy",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_copy" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SM_01_32_32_copy" "', argument " "2"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SM_01_32_32_copy" "', argument " "2"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->copy((nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > 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_delete__SM_01_32_32(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 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__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete__SM_01_32_32" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(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__SM_01_32_32_randomInitialize(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type arg2 ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type arg3 = (nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "nnz",(char *) "seed", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|O:_SM_01_32_32_randomInitialize",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_randomInitialize" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SM_01_32_32_randomInitialize" "', argument " "2"" of type '" "nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type >(val2);
  if (obj2) {
    ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SM_01_32_32_randomInitialize" "', argument " "3"" of type '" "nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type""'");
    } 
    arg3 = static_cast< nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type >(val3);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->randomInitialize(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__SM_01_32_32_getVersion(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 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 *) "binary", NULL 
  };
  std::string result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:_SM_01_32_32_getVersion",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_getVersion" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  if (obj1) {
    ecode2 = SWIG_AsVal_bool(obj1, &val2);
    if (!SWIG_IsOK(ecode2)) {
      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SM_01_32_32_getVersion" "', 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 = ((nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *)arg1)->getVersion(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_std_string(static_cast< std::string >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_nRows(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_nRows" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type)((nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *)arg1)->nRows();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__SM_01_32_32_nCols(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::nz_index_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_nCols" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseBinaryMatrix< unsigned int,unsigned int >::nz_index_type)((nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *)arg1)->nCols();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__SM_01_32_32_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_capacity" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type)((nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > 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_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


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


SWIGINTERN PyObject *_wrap__SM_01_32_32_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 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__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_clear" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(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__SM_01_32_32_resize(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type arg2 ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "new_nrows",(char *) "new_ncols", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SM_01_32_32_resize",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_resize" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SM_01_32_32_resize" "', argument " "2"" of type '" "nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SM_01_32_32_resize" "', argument " "3"" of type '" "nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type""'");
  } 
  arg3 = static_cast< nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resize(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__SM_01_32_32_nNonZerosOnRow(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row", NULL 
  };
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SM_01_32_32_nNonZerosOnRow",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_nNonZerosOnRow" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SM_01_32_32_nNonZerosOnRow" "', argument " "2"" of type '" "nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type)((nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *)arg1)->nNonZerosOnRow(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__SM_01_32_32_nNonZeros(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_nNonZeros" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type)((nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *)arg1)->nNonZeros();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__SM_01_32_32_nNonZerosInRowRange(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type arg2 ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type arg3 ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row",(char *) "col_begin",(char *) "col_end", NULL 
  };
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:_SM_01_32_32_nNonZerosInRowRange",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_nNonZerosInRowRange" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SM_01_32_32_nNonZerosInRowRange" "', argument " "2"" of type '" "nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SM_01_32_32_nNonZerosInRowRange" "', argument " "3"" of type '" "nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type""'");
  } 
  arg3 = static_cast< nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SM_01_32_32_nNonZerosInRowRange" "', argument " "4"" of type '" "nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type""'");
  } 
  arg4 = static_cast< nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type >(val4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type)((nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *)arg1)->nNonZerosInRowRange(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__SM_01_32_32_nNonZerosInBox(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type arg2 ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type arg3 ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type arg4 ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type arg5 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  unsigned int val5 ;
  int ecode5 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row_begin",(char *) "row_end",(char *) "col_begin",(char *) "col_end", NULL 
  };
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOO:_SM_01_32_32_nNonZerosInBox",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_nNonZerosInBox" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SM_01_32_32_nNonZerosInBox" "', argument " "2"" of type '" "nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SM_01_32_32_nNonZerosInBox" "', argument " "3"" of type '" "nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type""'");
  } 
  arg3 = static_cast< nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SM_01_32_32_nNonZerosInBox" "', argument " "4"" of type '" "nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type""'");
  } 
  arg4 = static_cast< nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type >(val4);
  ecode5 = SWIG_AsVal_unsigned_SS_int(obj4, &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "_SM_01_32_32_nNonZerosInBox" "', argument " "5"" of type '" "nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type""'");
  } 
  arg5 = static_cast< nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type >(val5);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type)((nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *)arg1)->nNonZerosInBox(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_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type arg2 ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row",(char *) "col", NULL 
  };
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SM_01_32_32_get",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_get" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SM_01_32_32_get" "', argument " "2"" of type '" "nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SM_01_32_32_get" "', argument " "3"" of type '" "nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type""'");
  } 
  arg3 = static_cast< nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type)((nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *)arg1)->get(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__SM_01_32_32_get_linear(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "n", NULL 
  };
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SM_01_32_32_get_linear",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_get_linear" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SM_01_32_32_get_linear" "', argument " "2"" of type '" "nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type)((nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *)arg1)->get_linear(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__SM_01_32_32_ind_begin_(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row", NULL 
  };
  SwigValueWrapper< std::vector< unsigned int >::const_iterator > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SM_01_32_32_ind_begin_",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_ind_begin_" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SM_01_32_32_ind_begin_" "', argument " "2"" of type '" "nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *)arg1)->ind_begin_(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 nupic::SparseBinaryMatrix< unsigned int,unsigned int >::Row::const_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_ind_end_(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row", NULL 
  };
  SwigValueWrapper< std::vector< unsigned int >::const_iterator > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SM_01_32_32_ind_end_",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_ind_end_" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SM_01_32_32_ind_end_" "', argument " "2"" of type '" "nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *)arg1)->ind_end_(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 nupic::SparseBinaryMatrix< unsigned int,unsigned int >::Row::const_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_getSparseRow(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row", NULL 
  };
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::Row *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SM_01_32_32_getSparseRow",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_getSparseRow" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SM_01_32_32_getSparseRow" "', argument " "2"" of type '" "nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseBinaryMatrix< unsigned int,unsigned int >::Row *) &((nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *)arg1)->getSparseRow(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__SM_01_32_32_appendEmptyCols(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned 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:_SM_01_32_32_appendEmptyCols",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_appendEmptyCols" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SM_01_32_32_appendEmptyCols" "', argument " "2"" of type '" "nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->appendEmptyCols(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__SM_01_32_32_setRangeToZero(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type arg2 ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type arg3 ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row",(char *) "begin",(char *) "end", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:_SM_01_32_32_setRangeToZero",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_setRangeToZero" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SM_01_32_32_setRangeToZero" "', argument " "2"" of type '" "nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SM_01_32_32_setRangeToZero" "', argument " "3"" of type '" "nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type""'");
  } 
  arg3 = static_cast< nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SM_01_32_32_setRangeToZero" "', argument " "4"" of type '" "nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type""'");
  } 
  arg4 = static_cast< nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type >(val4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setRangeToZero(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__SM_01_32_32_setRangeToOne(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type arg2 ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type arg3 ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row",(char *) "begin",(char *) "end", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:_SM_01_32_32_setRangeToOne",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_setRangeToOne" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SM_01_32_32_setRangeToOne" "', argument " "2"" of type '" "nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type""'");
  } 
  arg2 = static_cast< nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SM_01_32_32_setRangeToOne" "', argument " "3"" of type '" "nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type""'");
  } 
  arg3 = static_cast< nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SM_01_32_32_setRangeToOne" "', argument " "4"" of type '" "nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type""'");
  } 
  arg4 = static_cast< nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type >(val4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setRangeToOne(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__SM_01_32_32_transpose(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 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__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_transpose" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->transpose();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


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


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


SWIGINTERN PyObject *_wrap__SM_01_32_32_edges(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type arg2 = (nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type) 1 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "insideBorder", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:_SM_01_32_32_edges",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_edges" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  if (obj1) {
    ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
    if (!SWIG_IsOK(ecode2)) {
      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SM_01_32_32_edges" "', argument " "2"" of type '" "nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type""'");
    } 
    arg2 = static_cast< nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type >(val2);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->edges(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__SM_01_32_32_CSRSize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_CSRSize" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type)((nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *)arg1)->CSRSize();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__SM_01_32_32_fromCSR__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 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__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_fromCSR" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(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 '" "_SM_01_32_32_fromCSR" "', argument " "2"" of type '" "std::istream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SM_01_32_32_fromCSR" "', 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)->fromCSR(*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__SM_01_32_32_toCSR__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 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__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_toCSR" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(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 '" "_SM_01_32_32_toCSR" "', argument " "2"" of type '" "std::ostream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SM_01_32_32_toCSR" "', 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::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *)arg1)->toCSR(*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__SM_01_32_32_fromBinary(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 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:_SM_01_32_32_fromBinary",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_fromBinary" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__istream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SM_01_32_32_fromBinary" "', argument " "2"" of type '" "std::istream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SM_01_32_32_fromBinary" "', 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)->fromBinary(*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__SM_01_32_32_toBinary(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 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:_SM_01_32_32_toBinary",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_toBinary" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__ostream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SM_01_32_32_toBinary" "', argument " "2"" of type '" "std::ostream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SM_01_32_32_toBinary" "', 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::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *)arg1)->toBinary(*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__SM_01_32_32_write__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  SparseBinaryMatrixProto::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__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_write" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_SparseBinaryMatrixProto__Builder,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SM_01_32_32_write" "', argument " "2"" of type '" "SparseBinaryMatrixProto::Builder &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SM_01_32_32_write" "', argument " "2"" of type '" "SparseBinaryMatrixProto::Builder &""'"); 
  }
  arg2 = reinterpret_cast< SparseBinaryMatrixProto::Builder * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > 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__SM_01_32_32_read__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  SparseBinaryMatrixProto::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__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_read" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_SparseBinaryMatrixProto__Reader,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SM_01_32_32_read" "', argument " "2"" of type '" "SparseBinaryMatrixProto::Reader &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SM_01_32_32_read" "', argument " "2"" of type '" "SparseBinaryMatrixProto::Reader &""'"); 
  }
  arg2 = reinterpret_cast< SparseBinaryMatrixProto::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__SM_01_32_32_equals(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *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:_SM_01_32_32_equals",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_equals" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SM_01_32_32_equals" "', argument " "2"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SM_01_32_32_equals" "', argument " "2"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *)arg1)->equals((nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > 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__SM_01_32_32___getstate__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 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__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32___getstate__" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg____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__SM_01_32_32_readState(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "str", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SM_01_32_32_readState",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_readState" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__readState(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__SM_01_32_32_set__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::UInt32 arg2 ;
  nupic::UInt32 arg3 ;
  nupic::Real32 arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  float val4 ;
  int ecode4 = 0 ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_set" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SM_01_32_32_set" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SM_01_32_32_set" "', argument " "3"" of type '" "nupic::UInt32""'");
  } 
  arg3 = static_cast< nupic::UInt32 >(val3);
  ecode4 = SWIG_AsVal_float(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SM_01_32_32_set" "', argument " "4"" of type '" "nupic::Real32""'");
  } 
  arg4 = static_cast< nupic::Real32 >(val4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__set__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__SM_01_32_32_set__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::UInt32 arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  nupic::Real32 arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  float val4 ;
  int ecode4 = 0 ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_set" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SM_01_32_32_set" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  arg3 = swig_obj[2];
  ecode4 = SWIG_AsVal_float(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SM_01_32_32_set" "', argument " "4"" of type '" "nupic::Real32""'");
  } 
  arg4 = static_cast< nupic::Real32 >(val4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__set__SWIG_3(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__SM_01_32_32_set(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SM_01_32_32_set",0,4,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__SparseBinaryMatrixT_unsigned_int_unsigned_int_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_float(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 == 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__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 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;
      {
        {
          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 (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap__SM_01_32_32_set__SWIG_2(self, argc, argv);
    case 2:
      return _wrap__SM_01_32_32_set__SWIG_3(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SM_01_32_32_set'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 >::set(nupic::UInt32,nupic::UInt32,nupic::Real32)\n"
    "    nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 >::set(nupic::UInt32,PyObject *,nupic::Real32)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_setForAllRows(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  nupic::Real32 arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  float val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_indices",(char *) "v", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SM_01_32_32_setForAllRows",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_setForAllRows" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  arg2 = obj1;
  ecode3 = SWIG_AsVal_float(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SM_01_32_32_setForAllRows" "', argument " "3"" of type '" "nupic::Real32""'");
  } 
  arg3 = static_cast< nupic::Real32 >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__setForAllRows(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__SM_01_32_32_getAllNonZeros(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 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 *) "two_lists", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:_SM_01_32_32_getAllNonZeros",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_getAllNonZeros" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  if (obj1) {
    ecode2 = SWIG_AsVal_bool(obj1, &val2);
    if (!SWIG_IsOK(ecode2)) {
      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SM_01_32_32_getAllNonZeros" "', 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 = (PyObject *)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__getAllNonZeros((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_setAllNonZeros(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::UInt32 arg2 ;
  nupic::UInt32 arg3 ;
  PyObject *arg4 = (PyObject *) 0 ;
  PyObject *arg5 = (PyObject *) 0 ;
  bool arg6 = (bool) true ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 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 *) "nrows",(char *) "ncols",(char *) "py_i",(char *) "py_j",(char *) "sorted", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOO|O:_SM_01_32_32_setAllNonZeros",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_setAllNonZeros" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SM_01_32_32_setAllNonZeros" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SM_01_32_32_setAllNonZeros" "', argument " "3"" of type '" "nupic::UInt32""'");
  } 
  arg3 = static_cast< nupic::UInt32 >(val3);
  arg4 = obj3;
  arg5 = obj4;
  if (obj5) {
    ecode6 = SWIG_AsVal_bool(obj5, &val6);
    if (!SWIG_IsOK(ecode6)) {
      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "_SM_01_32_32_setAllNonZeros" "', argument " "6"" of type '" "bool""'");
    } 
    arg6 = static_cast< bool >(val6);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__setAllNonZeros(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__SM_01_32_32_setSlice__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::UInt32 arg2 ;
  nupic::UInt32 arg3 ;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int 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__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_setSlice" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SM_01_32_32_setSlice" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SM_01_32_32_setSlice" "', argument " "3"" of type '" "nupic::UInt32""'");
  } 
  arg3 = static_cast< nupic::UInt32 >(val3);
  res4 = SWIG_ConvertPtr(swig_obj[3], &argp4, SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t,  0  | 0);
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "_SM_01_32_32_setSlice" "', argument " "4"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const &""'"); 
  }
  if (!argp4) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SM_01_32_32_setSlice" "', argument " "4"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const &""'"); 
  }
  arg4 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__setSlice__SWIG_1(arg1,arg2,arg3,(nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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__SM_01_32_32_setSlice__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::UInt32 arg2 ;
  nupic::UInt32 arg3 ;
  PyObject *arg4 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_setSlice" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SM_01_32_32_setSlice" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SM_01_32_32_setSlice" "', argument " "3"" of type '" "nupic::UInt32""'");
  } 
  arg3 = static_cast< nupic::UInt32 >(val3);
  arg4 = swig_obj[3];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__setSlice__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__SM_01_32_32_setSlice(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SM_01_32_32_setSlice",0,4,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__SparseBinaryMatrixT_unsigned_int_unsigned_int_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_ConvertPtr(argv[3], 0, SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_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 == 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__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 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;
      {
        {
          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;
      {
        _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:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap__SM_01_32_32_setSlice__SWIG_1(self, argc, argv);
    case 2:
      return _wrap__SM_01_32_32_setSlice__SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SM_01_32_32_setSlice'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 >::setSlice(nupic::UInt32,nupic::UInt32,nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const &)\n"
    "    nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 >::setSlice(nupic::UInt32,nupic::UInt32,PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_getCol(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::UInt32 arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "col", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SM_01_32_32_getCol",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_getCol" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SM_01_32_32_getCol" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__getCol((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_zeroRowsIndicator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 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__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_zeroRowsIndicator" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__zeroRowsIndicator((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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__SM_01_32_32_nonZeroRowsIndicator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 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__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_nonZeroRowsIndicator" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__nonZeroRowsIndicator((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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__SM_01_32_32_nNonZerosPerRow(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 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__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_nNonZerosPerRow" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__nNonZerosPerRow((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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__SM_01_32_32_nNonZerosPerCol(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 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__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_nNonZerosPerCol" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__nNonZerosPerCol((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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__SM_01_32_32_nNonZerosPerBox(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 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 *) "box_i",(char *) "box_j", NULL 
  };
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SM_01_32_32_nNonZerosPerBox",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_nNonZerosPerBox" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  arg2 = obj1;
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__nNonZerosPerBox((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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((new nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >(static_cast< const nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >& >(result))), SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_rowSums(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 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__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_rowSums" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__rowSums((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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__SM_01_32_32_colSums(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 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__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_colSums" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__colSums((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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__SM_01_32_32_overlap(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_x", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SM_01_32_32_overlap",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_overlap" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__overlap((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_maxAllowedOverlap(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::Real32 arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  float val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "maxDistance",(char *) "py_x", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SM_01_32_32_maxAllowedOverlap",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_maxAllowedOverlap" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SM_01_32_32_maxAllowedOverlap" "', argument " "2"" of type '" "nupic::Real32""'");
  } 
  arg2 = static_cast< nupic::Real32 >(val2);
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__maxAllowedOverlap((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_appendSparseRow(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SM_01_32_32_appendSparseRow",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_appendSparseRow" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__appendSparseRow(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__SM_01_32_32_appendDenseRow(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SM_01_32_32_appendDenseRow",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_appendDenseRow" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__appendDenseRow(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__SM_01_32_32_replaceSparseRow(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::UInt32 arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row",(char *) "py_x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SM_01_32_32_replaceSparseRow",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_replaceSparseRow" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SM_01_32_32_replaceSparseRow" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__replaceSparseRow(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__SM_01_32_32_appendSparseCol(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SM_01_32_32_appendSparseCol",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_appendSparseCol" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__appendSparseCol(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__SM_01_32_32_getRowSparse(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::UInt32 arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SM_01_32_32_getRowSparse",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_getRowSparse" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SM_01_32_32_getRowSparse" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__getRowSparse((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_findRowSparse(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_x", NULL 
  };
  nupic::UInt32 result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SM_01_32_32_findRowSparse",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_findRowSparse" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt32)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__findRowSparse((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_findRowDense(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_x", NULL 
  };
  nupic::UInt32 result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SM_01_32_32_findRowDense",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_findRowDense" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt32)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__findRowDense((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_fromDense(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_m", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SM_01_32_32_fromDense",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_fromDense" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__fromDense(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__SM_01_32_32_toDense(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 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__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_toDense" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__toDense((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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__SM_01_32_32_toCSR__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_toCSR" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__toCSR__SWIG_1((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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__SM_01_32_32_toCSR(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SM_01_32_32_toCSR",0,2,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__SparseBinaryMatrixT_unsigned_int_unsigned_int_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__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 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__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__SM_01_32_32_toCSR__SWIG_1(self, argc, argv);
    case 2:
      return _wrap__SM_01_32_32_toCSR__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SM_01_32_32_toCSR'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 >::toCSR(std::ostream &) const\n"
    "    nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 >::toCSR() const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_fromCSR__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 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__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_fromCSR" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  arg2 = swig_obj[1];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__fromCSR__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__SM_01_32_32_fromCSR(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SM_01_32_32_fromCSR",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__SparseBinaryMatrixT_unsigned_int_unsigned_int_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_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__SparseBinaryMatrixT_unsigned_int_unsigned_int_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;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap__SM_01_32_32_fromCSR__SWIG_0(self, argc, argv);
    case 2:
      return _wrap__SM_01_32_32_fromCSR__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SM_01_32_32_fromCSR'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 >::fromCSR(std::istream &)\n"
    "    nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 >::fromCSR(PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_toPyString(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 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__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_toPyString" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__toPyString((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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__SM_01_32_32_fromPyString(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "s", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SM_01_32_32_fromPyString",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_fromPyString" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__fromPyString(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_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_CSRSaveToFile(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 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 *) "filename", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SM_01_32_32_CSRSaveToFile",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_CSRSaveToFile" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(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 '" "_SM_01_32_32_CSRSaveToFile" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SM_01_32_32_CSRSaveToFile" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__CSRSaveToFile((nupic::SparseBinaryMatrix< unsigned int,unsigned int > const *)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__SM_01_32_32_CSRLoadFromFile(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 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 *) "filename", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SM_01_32_32_CSRLoadFromFile",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_CSRLoadFromFile" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(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 '" "_SM_01_32_32_CSRLoadFromFile" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SM_01_32_32_CSRLoadFromFile" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__CSRLoadFromFile(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__SM_01_32_32_binarySaveToFile(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 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 *) "filename", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SM_01_32_32_binarySaveToFile",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_binarySaveToFile" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(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 '" "_SM_01_32_32_binarySaveToFile" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SM_01_32_32_binarySaveToFile" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__binarySaveToFile((nupic::SparseBinaryMatrix< unsigned int,unsigned int > const *)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__SM_01_32_32_binaryLoadFromFile(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 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 *) "filename", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SM_01_32_32_binaryLoadFromFile",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_binaryLoadFromFile" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(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 '" "_SM_01_32_32_binaryLoadFromFile" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SM_01_32_32_binaryLoadFromFile" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__binaryLoadFromFile(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__SM_01_32_32_write__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 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__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_write" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  arg2 = swig_obj[1];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__write__SWIG_1((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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__SM_01_32_32_write(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SM_01_32_32_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__SparseBinaryMatrixT_unsigned_int_unsigned_int_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_SparseBinaryMatrixProto__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__SparseBinaryMatrixT_unsigned_int_unsigned_int_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;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap__SM_01_32_32_write__SWIG_0(self, argc, argv);
    case 2:
      return _wrap__SM_01_32_32_write__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SM_01_32_32_write'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 >::write(SparseBinaryMatrixProto::Builder &) const\n"
    "    nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 >::write(PyObject *) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_read__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 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__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_read" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  arg2 = swig_obj[1];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__read__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__SM_01_32_32_read(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_SM_01_32_32_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__SparseBinaryMatrixT_unsigned_int_unsigned_int_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_SparseBinaryMatrixProto__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__SparseBinaryMatrixT_unsigned_int_unsigned_int_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;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap__SM_01_32_32_read__SWIG_0(self, argc, argv);
    case 2:
      return _wrap__SM_01_32_32_read__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_SM_01_32_32_read'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 >::read(SparseBinaryMatrixProto::Reader &)\n"
    "    nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 >::read(PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_fromSparseVector(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::UInt32 arg2 ;
  nupic::UInt32 arg3 ;
  PyObject *arg4 = (PyObject *) 0 ;
  nupic::UInt32 arg5 = (nupic::UInt32) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val5 ;
  int ecode5 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "nrows",(char *) "ncols",(char *) "py_x",(char *) "offset", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO|O:_SM_01_32_32_fromSparseVector",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_fromSparseVector" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SM_01_32_32_fromSparseVector" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SM_01_32_32_fromSparseVector" "', argument " "3"" of type '" "nupic::UInt32""'");
  } 
  arg3 = static_cast< nupic::UInt32 >(val3);
  arg4 = obj3;
  if (obj4) {
    ecode5 = SWIG_AsVal_unsigned_SS_int(obj4, &val5);
    if (!SWIG_IsOK(ecode5)) {
      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "_SM_01_32_32_fromSparseVector" "', argument " "5"" of type '" "nupic::UInt32""'");
    } 
    arg5 = static_cast< nupic::UInt32 >(val5);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__fromSparseVector(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__SM_01_32_32_toSparseVector(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::UInt32 arg2 = (nupic::UInt32) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "offset", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:_SM_01_32_32_toSparseVector",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_toSparseVector" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  if (obj1) {
    ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
    if (!SWIG_IsOK(ecode2)) {
      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SM_01_32_32_toSparseVector" "', argument " "2"" of type '" "nupic::UInt32""'");
    } 
    arg2 = static_cast< nupic::UInt32 >(val2);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__toSparseVector(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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_getRow(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::UInt32 arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SM_01_32_32_getRow",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_getRow" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SM_01_32_32_getRow" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__getRow((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_rowFromDense(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::UInt32 arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row",(char *) "py_x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SM_01_32_32_rowFromDense",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_rowFromDense" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SM_01_32_32_rowFromDense" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__rowFromDense(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__SM_01_32_32_rowToDense(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::UInt32 arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SM_01_32_32_rowToDense",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_rowToDense" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SM_01_32_32_rowToDense" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__rowToDense((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_rightVecSumAtNZ(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_x", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SM_01_32_32_rightVecSumAtNZ",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_rightVecSumAtNZ" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__rightVecSumAtNZ((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_rightVecSumAtNZ_fast(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 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 *) "py_x",(char *) "py_y", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SM_01_32_32_rightVecSumAtNZ_fast",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_rightVecSumAtNZ_fast" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  arg2 = obj1;
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__rightVecSumAtNZ_fast((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_leftVecSumAtNZ(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_x", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SM_01_32_32_leftVecSumAtNZ",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_leftVecSumAtNZ" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__leftVecSumAtNZ((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_leftVecSumAtNZ_fast(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 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 *) "py_x",(char *) "py_y", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SM_01_32_32_leftVecSumAtNZ_fast",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_leftVecSumAtNZ_fast" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  arg2 = obj1;
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__leftVecSumAtNZ_fast((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_rightDenseMatMaxAtNZ(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "mIn", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SM_01_32_32_rightDenseMatMaxAtNZ",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_rightDenseMatMaxAtNZ" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__rightDenseMatMaxAtNZ((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_leftDenseMatSumAtNZ(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "mIn", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SM_01_32_32_leftDenseMatSumAtNZ",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_leftDenseMatSumAtNZ" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__leftDenseMatSumAtNZ((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_leftDenseMatMaxAtNZ(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "mIn", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SM_01_32_32_leftDenseMatMaxAtNZ",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_leftDenseMatMaxAtNZ" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__leftDenseMatMaxAtNZ((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_minHammingDistance(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_x", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SM_01_32_32_minHammingDistance",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_minHammingDistance" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__minHammingDistance((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_firstRowCloserThan(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  nupic::UInt32 arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_x",(char *) "distance", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SM_01_32_32_firstRowCloserThan",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_firstRowCloserThan" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  arg2 = obj1;
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SM_01_32_32_firstRowCloserThan" "', argument " "3"" of type '" "nupic::UInt32""'");
  } 
  arg3 = static_cast< nupic::UInt32 >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__firstRowCloserThan((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_firstRowCloserThan_dense(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  nupic::UInt32 arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_x",(char *) "distance", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_SM_01_32_32_firstRowCloserThan_dense",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_firstRowCloserThan_dense" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  arg2 = obj1;
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SM_01_32_32_firstRowCloserThan_dense" "', argument " "3"" of type '" "nupic::UInt32""'");
  } 
  arg3 = static_cast< nupic::UInt32 >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__firstRowCloserThan_dense((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_vecMaxProd(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_x", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SM_01_32_32_vecMaxProd",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_vecMaxProd" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__vecMaxProd((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32_rightVecArgMaxAtNZ(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_x", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_SM_01_32_32_rightVecArgMaxAtNZ",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32_rightVecArgMaxAtNZ" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg__rightVecArgMaxAtNZ((nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__SM_01_32_32___eq__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *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:_SM_01_32_32___eq__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32___eq__" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SM_01_32_32___eq__" "', argument " "2"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SM_01_32_32___eq__" "', argument " "2"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg____eq__((nupic::SparseBinaryMatrix< unsigned int,unsigned int > const *)arg1,(nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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__SM_01_32_32___ne__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg1 = (nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *) 0 ;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *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:_SM_01_32_32___ne__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_SM_01_32_32___ne__" "', argument " "1"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_SM_01_32_32___ne__" "', argument " "2"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_SM_01_32_32___ne__" "', argument " "2"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)nupic_SparseBinaryMatrix_Sl_nupic_UInt32_Sc_nupic_UInt32_Sg____ne__((nupic::SparseBinaryMatrix< unsigned int,unsigned int > const *)arg1,(nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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 *_SM_01_32_32_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__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_kthroot_product(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = 0 ;
  nupic::UInt32 arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  nupic::Real32 arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  float val4 ;
  int ecode4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "sm",(char *) "segment_size",(char *) "xIn",(char *) "threshold", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:kthroot_product",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0  | 0);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "kthroot_product" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "kthroot_product" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "kthroot_product" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  arg3 = obj2;
  ecode4 = SWIG_AsVal_float(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "kthroot_product" "', argument " "4"" of type '" "nupic::Real32""'");
  } 
  arg4 = static_cast< nupic::Real32 >(val4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)kthroot_product((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sparseRightVecProd(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = 0 ;
  nupic::UInt32 arg2 ;
  nupic::UInt32 arg3 ;
  PyObject *arg4 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "a",(char *) "m",(char *) "n",(char *) "x", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:sparseRightVecProd",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0  | 0);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sparseRightVecProd" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "sparseRightVecProd" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sparseRightVecProd" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "sparseRightVecProd" "', argument " "3"" of type '" "nupic::UInt32""'");
  } 
  arg3 = static_cast< nupic::UInt32 >(val3);
  arg4 = obj3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)sparseRightVecProd((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_isZero_01(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject * obj0 = 0 ;
  char *  kwnames[] = {
    (char *) "py_x", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:isZero_01",kwnames,&obj0)) SWIG_fail;
  arg1 = obj0;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)isZero_01(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_dense_vector_sum(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject * obj0 = 0 ;
  char *  kwnames[] = {
    (char *) "py_x", NULL 
  };
  nupic::Real32 result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:dense_vector_sum",kwnames,&obj0)) SWIG_fail;
  arg1 = obj0;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real32)dense_vector_sum(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_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_binarize_with_threshold(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::Real32 arg1 ;
  PyObject *arg2 = (PyObject *) 0 ;
  float val1 ;
  int ecode1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "threshold",(char *) "py_x", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:binarize_with_threshold",kwnames,&obj0,&obj1)) SWIG_fail;
  ecode1 = SWIG_AsVal_float(obj0, &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "binarize_with_threshold" "', argument " "1"" of type '" "nupic::Real32""'");
  } 
  arg1 = static_cast< nupic::Real32 >(val1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)binarize_with_threshold(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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_nonZeroRowsIndicator_01(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::UInt32 arg1 ;
  nupic::UInt32 arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "nrows",(char *) "ncols",(char *) "py_x", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:nonZeroRowsIndicator_01",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  ecode1 = SWIG_AsVal_unsigned_SS_int(obj0, &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "nonZeroRowsIndicator_01" "', argument " "1"" of type '" "nupic::UInt32""'");
  } 
  arg1 = static_cast< nupic::UInt32 >(val1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "nonZeroRowsIndicator_01" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nonZeroRowsIndicator_01(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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_nonZeroColsIndicator_01(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::UInt32 arg1 ;
  nupic::UInt32 arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "nrows",(char *) "ncols",(char *) "py_x", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:nonZeroColsIndicator_01",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  ecode1 = SWIG_AsVal_unsigned_SS_int(obj0, &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "nonZeroColsIndicator_01" "', argument " "1"" of type '" "nupic::UInt32""'");
  } 
  arg1 = static_cast< nupic::UInt32 >(val1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "nonZeroColsIndicator_01" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nonZeroColsIndicator_01(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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_nNonZeroRows_01(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::UInt32 arg1 ;
  nupic::UInt32 arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "nrows",(char *) "ncols",(char *) "py_x", NULL 
  };
  nupic::UInt32 result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:nNonZeroRows_01",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  ecode1 = SWIG_AsVal_unsigned_SS_int(obj0, &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "nNonZeroRows_01" "', argument " "1"" of type '" "nupic::UInt32""'");
  } 
  arg1 = static_cast< nupic::UInt32 >(val1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "nNonZeroRows_01" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt32)nNonZeroRows_01(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_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_nNonZeroCols_01(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::UInt32 arg1 ;
  nupic::UInt32 arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "nrows",(char *) "ncols",(char *) "py_x", NULL 
  };
  nupic::UInt32 result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:nNonZeroCols_01",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  ecode1 = SWIG_AsVal_unsigned_SS_int(obj0, &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "nNonZeroCols_01" "', argument " "1"" of type '" "nupic::UInt32""'");
  } 
  arg1 = static_cast< nupic::UInt32 >(val1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "nNonZeroCols_01" "', argument " "2"" of type '" "nupic::UInt32""'");
  } 
  arg2 = static_cast< nupic::UInt32 >(val2);
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt32)nNonZeroCols_01(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_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_matrix_entropy(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = 0 ;
  nupic::Real32 arg2 = (nupic::Real32) 1.0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  float val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "sm",(char *) "s", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:matrix_entropy",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0  | 0);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "matrix_entropy" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "matrix_entropy" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  if (obj1) {
    ecode2 = SWIG_AsVal_float(obj1, &val2);
    if (!SWIG_IsOK(ecode2)) {
      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "matrix_entropy" "', argument " "2"" of type '" "nupic::Real32""'");
    } 
    arg2 = static_cast< nupic::Real32 >(val2);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)matrix_entropy((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_smoothVecMaxProd(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = 0 ;
  nupic::Real32 arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  float val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "sm",(char *) "k",(char *) "xIn", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:smoothVecMaxProd",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0  | 0);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "smoothVecMaxProd" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "smoothVecMaxProd" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "smoothVecMaxProd" "', argument " "2"" of type '" "nupic::Real32""'");
  } 
  arg2 = static_cast< nupic::Real32 >(val2);
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)smoothVecMaxProd((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_smoothVecArgMaxProd(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = 0 ;
  nupic::Real32 arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  float val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "sm",(char *) "k",(char *) "xIn", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:smoothVecArgMaxProd",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0  | 0);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "smoothVecArgMaxProd" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "smoothVecArgMaxProd" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "smoothVecArgMaxProd" "', argument " "2"" of type '" "nupic::Real32""'");
  } 
  arg2 = static_cast< nupic::Real32 >(val2);
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)smoothVecArgMaxProd((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_LBP_piPrime(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = 0 ;
  nupic::Real32 arg2 = (nupic::Real32) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  float val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "mat",(char *) "min_floor", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:LBP_piPrime",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "LBP_piPrime" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "LBP_piPrime" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  if (obj1) {
    ecode2 = SWIG_AsVal_float(obj1, &val2);
    if (!SWIG_IsOK(ecode2)) {
      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "LBP_piPrime" "', argument " "2"" of type '" "nupic::Real32""'");
    } 
    arg2 = static_cast< nupic::Real32 >(val2);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      LBP_piPrime(*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_SM_subtractNoAlloc(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = 0 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg2 = 0 ;
  double arg3 = (double) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "A",(char *) "B",(char *) "min_floor", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|O:SM_subtractNoAlloc",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SM_subtractNoAlloc" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SM_subtractNoAlloc" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SM_subtractNoAlloc" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SM_subtractNoAlloc" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp2);
  if (obj2) {
    ecode3 = SWIG_AsVal_double(obj2, &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SM_subtractNoAlloc" "', argument " "3"" of type '" "double""'");
    } 
    arg3 = static_cast< double >(val3);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      SM_subtractNoAlloc(*arg1,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SM_assignNoAlloc(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = 0 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *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 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SM_assignNoAlloc",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SM_assignNoAlloc" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SM_assignNoAlloc" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SM_assignNoAlloc" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SM_assignNoAlloc" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      SM_assignNoAlloc(*arg1,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SM_assignNoAllocFromBinary(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = 0 ;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *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 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SM_assignNoAllocFromBinary",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SM_assignNoAllocFromBinary" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SM_assignNoAllocFromBinary" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SM_assignNoAllocFromBinary" "', argument " "2"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SM_assignNoAllocFromBinary" "', argument " "2"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      SM_assignNoAllocFromBinary(*arg1,(nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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_SM_addConstantOnNonZeros(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = 0 ;
  nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *arg2 = 0 ;
  double arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "A",(char *) "B",(char *) "cval", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:SM_addConstantOnNonZeros",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SM_addConstantOnNonZeros" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SM_addConstantOnNonZeros" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SM_addConstantOnNonZeros" "', argument " "2"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SM_addConstantOnNonZeros" "', argument " "2"" of type '" "nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > * >(argp2);
  ecode3 = SWIG_AsVal_double(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SM_addConstantOnNonZeros" "', argument " "3"" of type '" "double""'");
  } 
  arg3 = static_cast< double >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      SM_addConstantOnNonZeros(*arg1,(nupic::SparseBinaryMatrix< unsigned int,unsigned int > 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_SM_logSumNoAlloc(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = 0 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg2 = 0 ;
  double arg3 = (double) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "A",(char *) "B",(char *) "min_floor", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|O:SM_logSumNoAlloc",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SM_logSumNoAlloc" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SM_logSumNoAlloc" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SM_logSumNoAlloc" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SM_logSumNoAlloc" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp2);
  if (obj2) {
    ecode3 = SWIG_AsVal_double(obj2, &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SM_logSumNoAlloc" "', argument " "3"" of type '" "double""'");
    } 
    arg3 = static_cast< double >(val3);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      SM_logSumNoAlloc(*arg1,(nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< 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_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SM_logAddValNoAlloc(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = 0 ;
  double arg2 ;
  double arg3 = (double) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "A",(char *) "val",(char *) "min_floor", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|O:SM_logAddValNoAlloc",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SM_logAddValNoAlloc" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SM_logAddValNoAlloc" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_double(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SM_logAddValNoAlloc" "', argument " "2"" of type '" "double""'");
  } 
  arg2 = static_cast< double >(val2);
  if (obj2) {
    ecode3 = SWIG_AsVal_double(obj2, &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SM_logAddValNoAlloc" "', argument " "3"" of type '" "double""'");
    } 
    arg3 = static_cast< double >(val3);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      SM_logAddValNoAlloc(*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_SM_logDiffNoAlloc(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = 0 ;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg2 = 0 ;
  double arg3 = (double) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "A",(char *) "B",(char *) "min_floor", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|O:SM_logDiffNoAlloc",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SM_logDiffNoAlloc" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SM_logDiffNoAlloc" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SM_logDiffNoAlloc" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SM_logDiffNoAlloc" "', argument " "2"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  arg2 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp2);
  if (obj2) {
    ecode3 = SWIG_AsVal_double(obj2, &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SM_logDiffNoAlloc" "', argument " "3"" of type '" "double""'");
    } 
    arg3 = static_cast< double >(val3);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      SM_logDiffNoAlloc(*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_SM_addToNZOnly(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = 0 ;
  double arg2 ;
  double arg3 = (double) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "A",(char *) "v",(char *) "min_floor", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|O:SM_addToNZOnly",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SM_addToNZOnly" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SM_addToNZOnly" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  ecode2 = SWIG_AsVal_double(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SM_addToNZOnly" "', argument " "2"" of type '" "double""'");
  } 
  arg2 = static_cast< double >(val2);
  if (obj2) {
    ecode3 = SWIG_AsVal_double(obj2, &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SM_addToNZOnly" "', argument " "3"" of type '" "double""'");
    } 
    arg3 = static_cast< double >(val3);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      SM_addToNZOnly(*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_SM_addToNZDownCols(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  double arg3 = (double) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "A",(char *) "py_x",(char *) "min_floor", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|O:SM_addToNZDownCols",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SM_addToNZDownCols" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SM_addToNZDownCols" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  if (obj2) {
    ecode3 = SWIG_AsVal_double(obj2, &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SM_addToNZDownCols" "', argument " "3"" of type '" "double""'");
    } 
    arg3 = static_cast< double >(val3);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      SM_addToNZDownCols(*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_SM_addToNZAcrossRows(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *arg1 = 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  double arg3 = (double) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "A",(char *) "py_x",(char *) "min_floor", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|O:SM_addToNZAcrossRows",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SM_addToNZAcrossRows" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SM_addToNZAcrossRows" "', argument " "1"" of type '" "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > &""'"); 
  }
  arg1 = reinterpret_cast< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > * >(argp1);
  arg2 = obj1;
  if (obj2) {
    ecode3 = SWIG_AsVal_double(obj2, &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SM_addToNZAcrossRows" "', argument " "3"" of type '" "double""'");
    } 
    arg3 = static_cast< double >(val3);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      SM_addToNZAcrossRows(*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_count_gt(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  nupic::Real32 arg2 ;
  float val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "py_x",(char *) "threshold", NULL 
  };
  nupic::UInt32 result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:count_gt",kwnames,&obj0,&obj1)) SWIG_fail;
  arg1 = obj0;
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "count_gt" "', argument " "2"" of type '" "nupic::Real32""'");
  } 
  arg2 = static_cast< nupic::Real32 >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt32)count_gt(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_count_gte(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  nupic::Real32 arg2 ;
  float val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "py_x",(char *) "threshold", NULL 
  };
  nupic::UInt32 result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:count_gte",kwnames,&obj0,&obj1)) SWIG_fail;
  arg1 = obj0;
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "count_gte" "', argument " "2"" of type '" "nupic::Real32""'");
  } 
  arg2 = static_cast< nupic::Real32 >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt32)count_gte(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_count_lt(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  nupic::Real32 arg2 ;
  float val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "py_x",(char *) "threshold", NULL 
  };
  nupic::UInt32 result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:count_lt",kwnames,&obj0,&obj1)) SWIG_fail;
  arg1 = obj0;
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "count_lt" "', argument " "2"" of type '" "nupic::Real32""'");
  } 
  arg2 = static_cast< nupic::Real32 >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt32)count_lt(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_partialArgsort(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  size_t arg1 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  int arg4 = (int) -1 ;
  size_t val1 ;
  int ecode1 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "k",(char *) "py_x",(char *) "py_r",(char *) "direction", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:partialArgsort",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  ecode1 = SWIG_AsVal_size_t(obj0, &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "partialArgsort" "', argument " "1"" of type '" "size_t""'");
  } 
  arg1 = static_cast< size_t >(val1);
  arg2 = obj1;
  arg3 = obj2;
  if (obj3) {
    ecode4 = SWIG_AsVal_int(obj3, &val4);
    if (!SWIG_IsOK(ecode4)) {
      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "partialArgsort" "', argument " "4"" of type '" "int""'");
    } 
    arg4 = static_cast< int >(val4);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      partialArgsort(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_positiveLearningPartialArgsort(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  size_t arg1 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  nupic::Random *arg4 = 0 ;
  bool arg5 = (bool) false ;
  size_t val1 ;
  int ecode1 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  bool val5 ;
  int ecode5 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  char *  kwnames[] = {
    (char *) "k",(char *) "py_x",(char *) "py_r",(char *) "rng",(char *) "real_random", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO|O:positiveLearningPartialArgsort",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
  ecode1 = SWIG_AsVal_size_t(obj0, &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "positiveLearningPartialArgsort" "', argument " "1"" of type '" "size_t""'");
  } 
  arg1 = static_cast< size_t >(val1);
  arg2 = obj1;
  arg3 = obj2;
  res4 = SWIG_ConvertPtr(obj3, &argp4, SWIGTYPE_p_nupic__Random,  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "positiveLearningPartialArgsort" "', argument " "4"" of type '" "nupic::Random &""'"); 
  }
  if (!argp4) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "positiveLearningPartialArgsort" "', argument " "4"" of type '" "nupic::Random &""'"); 
  }
  arg4 = reinterpret_cast< nupic::Random * >(argp4);
  if (obj4) {
    ecode5 = SWIG_AsVal_bool(obj4, &val5);
    if (!SWIG_IsOK(ecode5)) {
      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "positiveLearningPartialArgsort" "', argument " "5"" of type '" "bool""'");
    } 
    arg5 = static_cast< bool >(val5);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      positiveLearningPartialArgsort(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_logicalAnd(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 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:logicalAnd",kwnames,&obj0,&obj1)) SWIG_fail;
  arg1 = obj0;
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)logicalAnd(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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_logicalAnd2(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 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:logicalAnd2",kwnames,&obj0,&obj1)) SWIG_fail;
  arg1 = obj0;
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      logicalAnd2(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_new__NearestNeighbor32__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *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::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *)new nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__NearestNeighborT_nupic__SparseMatrixT_nupic__UInt32_nupic__Real32_nupic__Int32_nupic__Real64_nupic__DistanceToZeroT_nupic__Real32_t_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new__NearestNeighbor32__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::NearestNeighbor< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > >::size_type arg1 ;
  nupic::NearestNeighbor< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > >::size_type arg2 ;
  nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  {
    arg1 = (nupic::UInt32) PyLong_AsLong(swig_obj[0]);
  }
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(swig_obj[1]);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *)new nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > >(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__NearestNeighborT_nupic__SparseMatrixT_nupic__UInt32_nupic__Real32_nupic__Int32_nupic__Real64_nupic__DistanceToZeroT_nupic__Real32_t_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new__NearestNeighbor32__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::istream *arg1 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *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__NearestNeighbor32" "', argument " "1"" of type '" "std::istream &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new__NearestNeighbor32" "', 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::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *)new nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > >(*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__NearestNeighborT_nupic__SparseMatrixT_nupic__UInt32_nupic__Real32_nupic__Int32_nupic__Real64_nupic__DistanceToZeroT_nupic__Real32_t_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new__NearestNeighbor32__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *arg1 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_nupic__NearestNeighborT_nupic__SparseMatrixT_nupic__UInt32_nupic__Real32_nupic__Int32_nupic__Real64_nupic__DistanceToZeroT_nupic__Real32_t_t_t,  0  | 0);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new__NearestNeighbor32" "', argument " "1"" of type '" "nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > const &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new__NearestNeighbor32" "', argument " "1"" of type '" "nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > const &""'"); 
  }
  arg1 = reinterpret_cast< nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *)new nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > >((nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > 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__NearestNeighborT_nupic__SparseMatrixT_nupic__UInt32_nupic__Real32_nupic__Int32_nupic__Real64_nupic__DistanceToZeroT_nupic__Real32_t_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new__NearestNeighbor32(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new__NearestNeighbor32",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;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__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:
    
    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__NearestNeighborT_nupic__SparseMatrixT_nupic__UInt32_nupic__Real32_nupic__Int32_nupic__Real64_nupic__DistanceToZeroT_nupic__Real32_t_t_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_unsigned_SS_int(argv[0], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_4;
      _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_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__NearestNeighbor32__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new__NearestNeighbor32__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_new__NearestNeighbor32__SWIG_3(self, argc, argv);
    case 4:
      return _wrap_new__NearestNeighbor32__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new__NearestNeighbor32'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > >::NearestNeighbor()\n"
    "    nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > >::NearestNeighbor(nupic::NearestNeighbor< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > >::size_type,nupic::NearestNeighbor< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > >::size_type)\n"
    "    nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > >::NearestNeighbor(std::istream &)\n"
    "    nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > >::NearestNeighbor(nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__NearestNeighbor32_stddev__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *arg1 = (nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *) 0 ;
  std::vector< nupic::NearestNeighbor< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > >::value_type,std::allocator< nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > >::value_type > > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"_NearestNeighbor32_stddev__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__NearestNeighborT_nupic__SparseMatrixT_nupic__UInt32_nupic__Real32_nupic__Int32_nupic__Real64_nupic__DistanceToZeroT_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_NearestNeighbor32_stddev__set" "', argument " "1"" of type '" "nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > * >(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 '" "_NearestNeighbor32_stddev__set" "', argument " "2"" of type '" "std::vector< nupic::NearestNeighbor< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > >::value_type,std::allocator< nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > >::value_type > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "_NearestNeighbor32_stddev__set" "', argument " "2"" of type '" "std::vector< nupic::NearestNeighbor< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > >::value_type,std::allocator< nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > >::value_type > > const &""'"); 
    }
    arg2 = ptr;
  }
  if (arg1) (arg1)->stddev_ = *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__NearestNeighbor32_stddev__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *arg1 = (nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< nupic::NearestNeighbor< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > >::value_type,std::allocator< nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > >::value_type > > *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__NearestNeighborT_nupic__SparseMatrixT_nupic__UInt32_nupic__Real32_nupic__Int32_nupic__Real64_nupic__DistanceToZeroT_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_NearestNeighbor32_stddev__get" "', argument " "1"" of type '" "nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > * >(argp1);
  result = (std::vector< nupic::NearestNeighbor< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > >::value_type,std::allocator< nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > >::value_type > > *) & ((arg1)->stddev_);
  resultobj = swig::from(static_cast< std::vector<float,std::allocator< float > > >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__NearestNeighbor32_rowDist(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *arg1 = (nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *) 0 ;
  int arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row",(char *) "xIn", NULL 
  };
  nupic::Real result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_NearestNeighbor32_rowDist",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__NearestNeighborT_nupic__SparseMatrixT_nupic__UInt32_nupic__Real32_nupic__Int32_nupic__Real64_nupic__DistanceToZeroT_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_NearestNeighbor32_rowDist" "', argument " "1"" of type '" "nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_NearestNeighbor32_rowDist" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real)nupic_NearestNeighbor_Sl_nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__Sg__rowDist((nupic::NearestNeighbor< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > > 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_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__NearestNeighbor32_vecLpDist(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *arg1 = (nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *) 0 ;
  nupic::Real32 arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  bool arg4 = (bool) true ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool val4 ;
  int ecode4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "p",(char *) "xIn",(char *) "take_root", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:_NearestNeighbor32_vecLpDist",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__NearestNeighborT_nupic__SparseMatrixT_nupic__UInt32_nupic__Real32_nupic__Int32_nupic__Real64_nupic__DistanceToZeroT_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_NearestNeighbor32_vecLpDist" "', argument " "1"" of type '" "nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  arg3 = obj2;
  if (obj3) {
    ecode4 = SWIG_AsVal_bool(obj3, &val4);
    if (!SWIG_IsOK(ecode4)) {
      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_NearestNeighbor32_vecLpDist" "', 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_NearestNeighbor_Sl_nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__Sg__vecLpDist((nupic::NearestNeighbor< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > > 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__NearestNeighbor32_LpNearest(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *arg1 = (nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *) 0 ;
  nupic::Real32 arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  nupic::UInt32 arg4 = (nupic::UInt32) 1 ;
  bool arg5 = (bool) true ;
  void *argp1 = 0 ;
  int res1 = 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 *) "p",(char *) "row",(char *) "k",(char *) "take_root", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|OO:_NearestNeighbor32_LpNearest",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__NearestNeighborT_nupic__SparseMatrixT_nupic__UInt32_nupic__Real32_nupic__Int32_nupic__Real64_nupic__DistanceToZeroT_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_NearestNeighbor32_LpNearest" "', argument " "1"" of type '" "nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  arg3 = obj2;
  if (obj3) {
    {
      arg4 = (nupic::UInt32) PyLong_AsLong(obj3);
    }
  }
  if (obj4) {
    ecode5 = SWIG_AsVal_bool(obj4, &val5);
    if (!SWIG_IsOK(ecode5)) {
      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "_NearestNeighbor32_LpNearest" "', 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 = (PyObject *)nupic_NearestNeighbor_Sl_nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__Sg__LpNearest((nupic::NearestNeighbor< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > > const *)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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__NearestNeighbor32_closestLp_w(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *arg1 = (nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *) 0 ;
  nupic::Real32 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 *) "p",(char *) "row", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_NearestNeighbor32_closestLp_w",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__NearestNeighborT_nupic__SparseMatrixT_nupic__UInt32_nupic__Real32_nupic__Int32_nupic__Real64_nupic__DistanceToZeroT_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_NearestNeighbor32_closestLp_w" "', argument " "1"" of type '" "nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_NearestNeighbor_Sl_nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__Sg__closestLp_w(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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__NearestNeighbor32_closestDot(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *arg1 = (nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "row", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:_NearestNeighbor32_closestDot",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__NearestNeighborT_nupic__SparseMatrixT_nupic__UInt32_nupic__Real32_nupic__Int32_nupic__Real64_nupic__DistanceToZeroT_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_NearestNeighbor32_closestDot" "', argument " "1"" of type '" "nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_NearestNeighbor_Sl_nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__Sg__closestDot(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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__NearestNeighbor32_projLpNearest(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *arg1 = (nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *) 0 ;
  nupic::Real32 arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  nupic::UInt32 arg4 = (nupic::UInt32) 1 ;
  bool arg5 = (bool) false ;
  void *argp1 = 0 ;
  int res1 = 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 *) "p",(char *) "py_x",(char *) "k",(char *) "take_root", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|OO:_NearestNeighbor32_projLpNearest",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__NearestNeighborT_nupic__SparseMatrixT_nupic__UInt32_nupic__Real32_nupic__Int32_nupic__Real64_nupic__DistanceToZeroT_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_NearestNeighbor32_projLpNearest" "', argument " "1"" of type '" "nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  arg3 = obj2;
  if (obj3) {
    {
      arg4 = (nupic::UInt32) PyLong_AsLong(obj3);
    }
  }
  if (obj4) {
    ecode5 = SWIG_AsVal_bool(obj4, &val5);
    if (!SWIG_IsOK(ecode5)) {
      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "_NearestNeighbor32_projLpNearest" "', 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 = (PyObject *)nupic_NearestNeighbor_Sl_nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__Sg__projLpNearest((nupic::NearestNeighbor< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > > const *)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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__NearestNeighbor32_projRbf(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *arg1 = (nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *) 0 ;
  nupic::Real32 arg2 ;
  nupic::Real32 arg3 ;
  PyObject *arg4 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "p",(char *) "k",(char *) "py_x", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:_NearestNeighbor32_projRbf",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__NearestNeighborT_nupic__SparseMatrixT_nupic__UInt32_nupic__Real32_nupic__Int32_nupic__Real64_nupic__DistanceToZeroT_nupic__Real32_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_NearestNeighbor32_projRbf" "', argument " "1"" of type '" "nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  {
    arg3 = (nupic::Real32) PyFloat_AsDouble(obj2);
  }
  arg4 = obj3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_NearestNeighbor_Sl_nupic_SparseMatrix_Sl_nupic_UInt32_Sc_nupic_Real32_Sc_nupic_Int32_Sc_nupic_Real64_Sc_nupic_DistanceToZero_Sl_nupic_Real32_Sg__Sg__Sg__projRbf((nupic::NearestNeighbor< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > > 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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete__NearestNeighbor32(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *arg1 = (nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *) 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__NearestNeighborT_nupic__SparseMatrixT_nupic__UInt32_nupic__Real32_nupic__Int32_nupic__Real64_nupic__DistanceToZeroT_nupic__Real32_t_t_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete__NearestNeighbor32" "', argument " "1"" of type '" "nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > * >(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 *_NearestNeighbor32_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__NearestNeighborT_nupic__SparseMatrixT_nupic__UInt32_nupic__Real32_nupic__Int32_nupic__Real64_nupic__DistanceToZeroT_nupic__Real32_t_t_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_min_score_per_category(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::UInt32 arg1 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "maxCategoryIdx",(char *) "c_py",(char *) "d_py", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:min_score_per_category",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  {
    arg1 = (nupic::UInt32) PyLong_AsLong(obj0);
  }
  arg2 = obj1;
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)min_score_per_category(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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_l2_norm(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject * obj0 = 0 ;
  char *  kwnames[] = {
    (char *) "py_x", NULL 
  };
  nupic::Real32 result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:l2_norm",kwnames,&obj0)) SWIG_fail;
  arg1 = obj0;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real32)l2_norm(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_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


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


SWIGINTERN PyObject *_wrap__Gaussian2D_32_c_x_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Gaussian2D< nupic::Real32 > *arg1 = (nupic::Gaussian2D< nupic::Real32 > *) 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__Gaussian2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_Gaussian2D_32_c_x_get" "', argument " "1"" of type '" "nupic::Gaussian2D< nupic::Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Gaussian2D< nupic::Real32 > * >(argp1);
  result = (float) ((arg1)->c_x);
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


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


SWIGINTERN PyObject *_wrap__Gaussian2D_32_c_y_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Gaussian2D< nupic::Real32 > *arg1 = (nupic::Gaussian2D< nupic::Real32 > *) 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__Gaussian2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_Gaussian2D_32_c_y_get" "', argument " "1"" of type '" "nupic::Gaussian2D< nupic::Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Gaussian2D< nupic::Real32 > * >(argp1);
  result = (float) ((arg1)->c_y);
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


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


SWIGINTERN PyObject *_wrap__Gaussian2D_32_s00_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Gaussian2D< nupic::Real32 > *arg1 = (nupic::Gaussian2D< nupic::Real32 > *) 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__Gaussian2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_Gaussian2D_32_s00_get" "', argument " "1"" of type '" "nupic::Gaussian2D< nupic::Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Gaussian2D< nupic::Real32 > * >(argp1);
  result = (float) ((arg1)->s00);
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


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


SWIGINTERN PyObject *_wrap__Gaussian2D_32_s01_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Gaussian2D< nupic::Real32 > *arg1 = (nupic::Gaussian2D< nupic::Real32 > *) 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__Gaussian2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_Gaussian2D_32_s01_get" "', argument " "1"" of type '" "nupic::Gaussian2D< nupic::Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Gaussian2D< nupic::Real32 > * >(argp1);
  result = (float) ((arg1)->s01);
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


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


SWIGINTERN PyObject *_wrap__Gaussian2D_32_s10_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Gaussian2D< nupic::Real32 > *arg1 = (nupic::Gaussian2D< nupic::Real32 > *) 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__Gaussian2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_Gaussian2D_32_s10_get" "', argument " "1"" of type '" "nupic::Gaussian2D< nupic::Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Gaussian2D< nupic::Real32 > * >(argp1);
  result = (float) ((arg1)->s10);
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


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


SWIGINTERN PyObject *_wrap__Gaussian2D_32_s11_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Gaussian2D< nupic::Real32 > *arg1 = (nupic::Gaussian2D< nupic::Real32 > *) 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__Gaussian2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_Gaussian2D_32_s11_get" "', argument " "1"" of type '" "nupic::Gaussian2D< nupic::Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Gaussian2D< nupic::Real32 > * >(argp1);
  result = (float) ((arg1)->s11);
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


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


SWIGINTERN PyObject *_wrap__Gaussian2D_32_s2_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Gaussian2D< nupic::Real32 > *arg1 = (nupic::Gaussian2D< nupic::Real32 > *) 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__Gaussian2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_Gaussian2D_32_s2_get" "', argument " "1"" of type '" "nupic::Gaussian2D< nupic::Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Gaussian2D< nupic::Real32 > * >(argp1);
  result = (float) ((arg1)->s2);
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


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


SWIGINTERN PyObject *_wrap__Gaussian2D_32_k1_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Gaussian2D< nupic::Real32 > *arg1 = (nupic::Gaussian2D< nupic::Real32 > *) 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__Gaussian2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_Gaussian2D_32_k1_get" "', argument " "1"" of type '" "nupic::Gaussian2D< nupic::Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Gaussian2D< nupic::Real32 > * >(argp1);
  result = (float) ((arg1)->k1);
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new__Gaussian2D_32__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  float arg1 ;
  float arg2 ;
  float arg3 ;
  float arg4 ;
  float arg5 ;
  float arg6 ;
  nupic::Gaussian2D< nupic::Real32 > *result = 0 ;
  
  if ((nobjs < 6) || (nobjs > 6)) SWIG_fail;
  {
    arg1 = (nupic::Real32) PyFloat_AsDouble(swig_obj[0]);
  }
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(swig_obj[1]);
  }
  {
    arg3 = (nupic::Real32) PyFloat_AsDouble(swig_obj[2]);
  }
  {
    arg4 = (nupic::Real32) PyFloat_AsDouble(swig_obj[3]);
  }
  {
    arg5 = (nupic::Real32) PyFloat_AsDouble(swig_obj[4]);
  }
  {
    arg6 = (nupic::Real32) PyFloat_AsDouble(swig_obj[5]);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Gaussian2D< nupic::Real32 > *)new nupic::Gaussian2D< nupic::Real32 >(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__Gaussian2DT_float_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new__Gaussian2D_32__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::Gaussian2D< nupic::Real32 > *arg1 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::Gaussian2D< nupic::Real32 > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_nupic__Gaussian2DT_float_t,  0  | 0);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new__Gaussian2D_32" "', argument " "1"" of type '" "nupic::Gaussian2D< nupic::Real32 > const &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new__Gaussian2D_32" "', argument " "1"" of type '" "nupic::Gaussian2D< nupic::Real32 > const &""'"); 
  }
  arg1 = reinterpret_cast< nupic::Gaussian2D< nupic::Real32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Gaussian2D< nupic::Real32 > *)new nupic::Gaussian2D< nupic::Real32 >((nupic::Gaussian2D< nupic::Real32 > 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__Gaussian2DT_float_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new__Gaussian2D_32(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[7];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new__Gaussian2D_32",0,6,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;
      {
        int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_nupic__Gaussian2DT_float_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 == 6) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        {
          int res = SWIG_AsVal_float(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;
      {
        {
          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;
      {
        {
          int res = SWIG_AsVal_float(argv[4], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          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_new__Gaussian2D_32__SWIG_1(self, argc, argv);
    case 2:
      return _wrap_new__Gaussian2D_32__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new__Gaussian2D_32'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::Gaussian2D< nupic::Real32 >::Gaussian2D(float,float,float,float,float,float)\n"
    "    nupic::Gaussian2D< nupic::Real32 >::Gaussian2D(nupic::Gaussian2D< nupic::Real32 > const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__Gaussian2D_32___call__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::Gaussian2D< nupic::Real32 > *arg1 = (nupic::Gaussian2D< nupic::Real32 > *) 0 ;
  float arg2 ;
  float arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x",(char *) "y", NULL 
  };
  float result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_Gaussian2D_32___call__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__Gaussian2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_Gaussian2D_32___call__" "', argument " "1"" of type '" "nupic::Gaussian2D< nupic::Real32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Gaussian2D< nupic::Real32 > * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  {
    arg3 = (nupic::Real32) PyFloat_AsDouble(obj2);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (float)((nupic::Gaussian2D< nupic::Real32 > const *)arg1)->operator ()(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__Gaussian2D_32_eval(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::Gaussian2D< nupic::Real32 > *arg1 = (nupic::Gaussian2D< nupic::Real32 > *) 0 ;
  nupic::Real32 arg2 ;
  nupic::Real32 arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x",(char *) "y", NULL 
  };
  nupic::Real32 result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:_Gaussian2D_32_eval",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__Gaussian2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_Gaussian2D_32_eval" "', argument " "1"" of type '" "nupic::Gaussian2D< nupic::Real32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Gaussian2D< nupic::Real32 > * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  {
    arg3 = (nupic::Real32) PyFloat_AsDouble(obj2);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real32)nupic_Gaussian2D_Sl_nupic_Real32_Sg__eval((nupic::Gaussian2D< float > 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_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete__Gaussian2D_32(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Gaussian2D< nupic::Real32 > *arg1 = (nupic::Gaussian2D< nupic::Real32 > *) 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__Gaussian2DT_float_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete__Gaussian2D_32" "', argument " "1"" of type '" "nupic::Gaussian2D< nupic::Real32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Gaussian2D< nupic::Real32 > * >(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 *_Gaussian2D_32_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__Gaussian2DT_float_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new__Set__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  nupic::Set< nupic::UInt32 > *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::Set< nupic::UInt32 > *)new nupic::Set< nupic::UInt32 >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__SetT_unsigned_int_unsigned_char_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new__Set__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  unsigned int arg1 ;
  unsigned int arg2 ;
  unsigned int *arg3 = (unsigned int *) 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  nupic::Set< nupic::UInt32 > *result = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  {
    arg1 = (nupic::UInt32) PyLong_AsLong(swig_obj[0]);
  }
  {
    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 '" "new__Set" "', argument " "3"" of type '" "unsigned int *""'"); 
  }
  arg3 = reinterpret_cast< unsigned int * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Set< nupic::UInt32 > *)new nupic::Set< nupic::UInt32 >(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__SetT_unsigned_int_unsigned_char_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__Set_construct__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::Set< nupic::UInt32 > *arg1 = (nupic::Set< nupic::UInt32 > *) 0 ;
  unsigned int arg2 ;
  unsigned int arg3 ;
  unsigned int *arg4 = (unsigned int *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SetT_unsigned_int_unsigned_char_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_Set_construct" "', argument " "1"" of type '" "nupic::Set< nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Set< nupic::UInt32 > * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(swig_obj[1]);
  }
  {
    arg3 = (nupic::UInt32) PyLong_AsLong(swig_obj[2]);
  }
  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 '" "_Set_construct" "', argument " "4"" of type '" "unsigned int *""'"); 
  }
  arg4 = reinterpret_cast< unsigned int * >(argp4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->construct(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_new__Set__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::Set< nupic::UInt32 > *arg1 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::Set< nupic::UInt32 > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_nupic__SetT_unsigned_int_unsigned_char_t,  0  | 0);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new__Set" "', argument " "1"" of type '" "nupic::Set< nupic::UInt32 > const &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new__Set" "', argument " "1"" of type '" "nupic::Set< nupic::UInt32 > const &""'"); 
  }
  arg1 = reinterpret_cast< nupic::Set< nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Set< nupic::UInt32 > *)new nupic::Set< nupic::UInt32 >((nupic::Set< nupic::UInt32 > 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__SetT_unsigned_int_unsigned_char_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new__Set(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new__Set",0,3,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__SetT_unsigned_int_unsigned_char_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_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;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_unsigned_int, 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__Set__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new__Set__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_new__Set__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new__Set'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::Set< nupic::UInt32 >::Set()\n"
    "    nupic::Set< nupic::UInt32 >::Set(unsigned int,unsigned int,unsigned int *)\n"
    "    nupic::Set< nupic::UInt32 >::Set(nupic::Set< nupic::UInt32 > const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__Set_n_elements(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Set< nupic::UInt32 > *arg1 = (nupic::Set< nupic::UInt32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  unsigned int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SetT_unsigned_int_unsigned_char_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_Set_n_elements" "', argument " "1"" of type '" "nupic::Set< nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Set< nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (unsigned int)((nupic::Set< nupic::UInt32 > const *)arg1)->n_elements();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__Set_max_index(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Set< nupic::UInt32 > *arg1 = (nupic::Set< nupic::UInt32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  unsigned int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SetT_unsigned_int_unsigned_char_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_Set_max_index" "', argument " "1"" of type '" "nupic::Set< nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Set< nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (unsigned int)((nupic::Set< nupic::UInt32 > const *)arg1)->max_index();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__Set_n_bytes(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Set< nupic::UInt32 > *arg1 = (nupic::Set< nupic::UInt32 > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  unsigned int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SetT_unsigned_int_unsigned_char_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_Set_n_bytes" "', argument " "1"" of type '" "nupic::Set< nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Set< nupic::UInt32 > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (unsigned int)((nupic::Set< nupic::UInt32 > const *)arg1)->n_bytes();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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__Set_intersection__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::Set< nupic::UInt32 > *arg1 = (nupic::Set< nupic::UInt32 > *) 0 ;
  unsigned int arg2 ;
  unsigned int *arg3 = (unsigned int *) 0 ;
  unsigned int *arg4 = (unsigned int *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  unsigned int result;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SetT_unsigned_int_unsigned_char_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_Set_intersection" "', argument " "1"" of type '" "nupic::Set< nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Set< nupic::UInt32 > * >(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 '" "_Set_intersection" "', argument " "3"" of type '" "unsigned int *""'"); 
  }
  arg3 = reinterpret_cast< unsigned int * >(argp3);
  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 '" "_Set_intersection" "', argument " "4"" of type '" "unsigned int *""'"); 
  }
  arg4 = reinterpret_cast< unsigned int * >(argp4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (unsigned int)((nupic::Set< nupic::UInt32 > const *)arg1)->intersection(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__Set_construct__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::Set< nupic::UInt32 > *arg1 = (nupic::Set< nupic::UInt32 > *) 0 ;
  nupic::UInt32 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__SetT_unsigned_int_unsigned_char_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_Set_construct" "', argument " "1"" of type '" "nupic::Set< nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Set< nupic::UInt32 > * >(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_Set_Sl_nupic_UInt32_Sg__construct__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__Set_construct(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_Set_construct",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_nupic__SetT_unsigned_int_unsigned_char_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;
      {
        _v = (argv[2] != 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 == 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__SetT_unsigned_int_unsigned_char_t, 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;
      {
        {
          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;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[3], &vptr, SWIGTYPE_p_unsigned_int, 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__Set_construct__SWIG_1(self, argc, argv);
    case 2:
      return _wrap__Set_construct__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_Set_construct'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::Set< nupic::UInt32 >::construct(unsigned int,unsigned int,unsigned int *)\n"
    "    nupic::Set< nupic::UInt32 >::construct(nupic::UInt32,PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap__Set_intersection__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::Set< nupic::UInt32 > *arg1 = (nupic::Set< nupic::UInt32 > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::UInt32 result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__SetT_unsigned_int_unsigned_char_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_Set_intersection" "', argument " "1"" of type '" "nupic::Set< nupic::UInt32 > const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Set< nupic::UInt32 > * >(argp1);
  arg2 = swig_obj[1];
  arg3 = swig_obj[2];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt32)nupic_Set_Sl_nupic_UInt32_Sg__intersection__SWIG_1((nupic::Set< unsigned int > 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_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__Set_intersection(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"_Set_intersection",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_nupic__SetT_unsigned_int_unsigned_char_t, 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;
      {
        _v = (argv[2] != 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 == 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__SetT_unsigned_int_unsigned_char_t, 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;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_unsigned_int, 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[3], &vptr, SWIGTYPE_p_unsigned_int, 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__Set_intersection__SWIG_1(self, argc, argv);
    case 2:
      return _wrap__Set_intersection__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function '_Set_intersection'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::Set< nupic::UInt32 >::intersection(unsigned int,unsigned int *,unsigned int *) const\n"
    "    nupic::Set< nupic::UInt32 >::intersection(PyObject *,PyObject *) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_delete__Set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Set< nupic::UInt32 > *arg1 = (nupic::Set< nupic::UInt32 > *) 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__SetT_unsigned_int_unsigned_char_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete__Set" "', argument " "1"" of type '" "nupic::Set< nupic::UInt32 > *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Set< nupic::UInt32 > * >(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 *_Set_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__SetT_unsigned_int_unsigned_char_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

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


SWIGINTERN PyObject *_wrap_new_PyTensorIndex__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  PyTensorIndex *arg1 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyTensorIndex *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_PyTensorIndex,  0  | 0);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_PyTensorIndex" "', argument " "1"" of type '" "PyTensorIndex const &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_PyTensorIndex" "', argument " "1"" of type '" "PyTensorIndex const &""'"); 
  }
  arg1 = reinterpret_cast< PyTensorIndex * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyTensorIndex *)new PyTensorIndex((PyTensorIndex 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_PyTensorIndex, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_PyTensorIndex__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::UInt32 arg1 ;
  PyTensorIndex *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 = (PyTensorIndex *)new PyTensorIndex(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_PyTensorIndex, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_PyTensorIndex__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::UInt32 arg1 ;
  nupic::UInt32 arg2 ;
  PyTensorIndex *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  {
    arg1 = (nupic::UInt32) PyLong_AsLong(swig_obj[0]);
  }
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(swig_obj[1]);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyTensorIndex *)new PyTensorIndex(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_PyTensorIndex, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_PyTensorIndex__SWIG_4(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::UInt32 arg1 ;
  nupic::UInt32 arg2 ;
  nupic::UInt32 arg3 ;
  PyTensorIndex *result = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) 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]);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyTensorIndex *)new PyTensorIndex(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_PyTensorIndex, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_PyTensorIndex__SWIG_5(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::UInt32 arg1 ;
  nupic::UInt32 arg2 ;
  nupic::UInt32 arg3 ;
  nupic::UInt32 arg4 ;
  PyTensorIndex *result = 0 ;
  
  if ((nobjs < 4) || (nobjs > 4)) 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]);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyTensorIndex *)new PyTensorIndex(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_PyTensorIndex, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_PyTensorIndex__SWIG_6(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 ;
  PyTensorIndex *result = 0 ;
  
  if ((nobjs < 5) || (nobjs > 5)) 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]);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyTensorIndex *)new PyTensorIndex(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_PyTensorIndex, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_PyTensorIndex__SWIG_7(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 ;
  PyTensorIndex *result = 0 ;
  
  if ((nobjs < 6) || (nobjs > 6)) 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]);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyTensorIndex *)new PyTensorIndex(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_PyTensorIndex, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_PyTensorIndex__SWIG_8(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  TIV *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  PyTensorIndex *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) 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_PyTensorIndex" "', argument " "1"" of type '" "TIV const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_PyTensorIndex" "', argument " "1"" of type '" "TIV const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyTensorIndex *)new PyTensorIndex((TIV 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_PyTensorIndex, 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_PyTensorIndex__SWIG_10(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  PyTensorIndex *arg1 = 0 ;
  PyTensorIndex *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyTensorIndex *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_PyTensorIndex,  0  | 0);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_PyTensorIndex" "', argument " "1"" of type '" "PyTensorIndex const &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_PyTensorIndex" "', argument " "1"" of type '" "PyTensorIndex const &""'"); 
  }
  arg1 = reinterpret_cast< PyTensorIndex * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_PyTensorIndex,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_PyTensorIndex" "', argument " "2"" of type '" "PyTensorIndex const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_PyTensorIndex" "', argument " "2"" of type '" "PyTensorIndex const &""'"); 
  }
  arg2 = reinterpret_cast< PyTensorIndex * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyTensorIndex *)new PyTensorIndex((PyTensorIndex const &)*arg1,(PyTensorIndex 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_PyTensorIndex, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_PyTensorIndex(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[7];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_PyTensorIndex",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 == 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_PyTensorIndex, 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 == 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_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 == 1) {
      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_4;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 4;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_4:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_PyTensorIndex, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_5;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_PyTensorIndex, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_5;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 5;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_5:
    
    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_6;
      _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_6;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 6;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_6:
    
    if (argc == 3) {
      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_7;
      _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_7;
      _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_7;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 7;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_7:
    
    if (argc == 4) {
      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_8;
      _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_8;
      _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_8;
      _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_8;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 8;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_8:
    
    if (argc == 5) {
      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_9;
      _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_9;
      _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_9;
      _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_9;
      _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_9;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 9;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_9:
    
    if (argc == 6) {
      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_10;
      _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_10;
      _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_10;
      _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_10;
      _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_10;
      _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_10;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 10;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_10:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_new_PyTensorIndex__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_PyTensorIndex__SWIG_1(self, argc, argv);
    case 3:
      return _wrap_new_PyTensorIndex__SWIG_2(self, argc, argv);
    case 4:
      return _wrap_new_PyTensorIndex__SWIG_8(self, argc, argv);
    case 5:
      return _wrap_new_PyTensorIndex__SWIG_10(self, argc, argv);
    case 6:
      return _wrap_new_PyTensorIndex__SWIG_3(self, argc, argv);
    case 7:
      return _wrap_new_PyTensorIndex__SWIG_4(self, argc, argv);
    case 8:
      return _wrap_new_PyTensorIndex__SWIG_5(self, argc, argv);
    case 9:
      return _wrap_new_PyTensorIndex__SWIG_6(self, argc, argv);
    case 10:
      return _wrap_new_PyTensorIndex__SWIG_7(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_PyTensorIndex'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    PyTensorIndex::PyTensorIndex()\n"
    "    PyTensorIndex::PyTensorIndex(PyTensorIndex const &)\n"
    "    PyTensorIndex::PyTensorIndex(nupic::UInt32)\n"
    "    PyTensorIndex::PyTensorIndex(nupic::UInt32,nupic::UInt32)\n"
    "    PyTensorIndex::PyTensorIndex(nupic::UInt32,nupic::UInt32,nupic::UInt32)\n"
    "    PyTensorIndex::PyTensorIndex(nupic::UInt32,nupic::UInt32,nupic::UInt32,nupic::UInt32)\n"
    "    PyTensorIndex::PyTensorIndex(nupic::UInt32,nupic::UInt32,nupic::UInt32,nupic::UInt32,nupic::UInt32)\n"
    "    PyTensorIndex::PyTensorIndex(nupic::UInt32,nupic::UInt32,nupic::UInt32,nupic::UInt32,nupic::UInt32,nupic::UInt32)\n"
    "    PyTensorIndex::PyTensorIndex(TIV const &)\n"
    "    PyTensorIndex::PyTensorIndex(PyTensorIndex const &,PyTensorIndex const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_PyTensorIndex_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  PyTensorIndex *arg1 = (PyTensorIndex *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt32 result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PyTensorIndex, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PyTensorIndex_size" "', argument " "1"" of type '" "PyTensorIndex const *""'"); 
  }
  arg1 = reinterpret_cast< PyTensorIndex * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt32)((PyTensorIndex 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_PyTensorIndex___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PyTensorIndex *arg1 = (PyTensorIndex *) 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 
  };
  nupic::UInt32 result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:PyTensorIndex___getitem__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PyTensorIndex, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PyTensorIndex___getitem__" "', argument " "1"" of type '" "PyTensorIndex const *""'"); 
  }
  arg1 = reinterpret_cast< PyTensorIndex * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "PyTensorIndex___getitem__" "', 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::UInt32)((PyTensorIndex const *)arg1)->__getitem__(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_PyTensorIndex___setitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PyTensorIndex *arg1 = (PyTensorIndex *) 0 ;
  int arg2 ;
  nupic::UInt32 arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "d", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:PyTensorIndex___setitem__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PyTensorIndex, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PyTensorIndex___setitem__" "', argument " "1"" of type '" "PyTensorIndex *""'"); 
  }
  arg1 = reinterpret_cast< PyTensorIndex * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "PyTensorIndex___setitem__" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  {
    arg3 = (nupic::UInt32) PyLong_AsLong(obj2);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->__setitem__(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_PyTensorIndex___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  PyTensorIndex *arg1 = (PyTensorIndex *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt32 result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PyTensorIndex, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PyTensorIndex___len__" "', argument " "1"" of type '" "PyTensorIndex const *""'"); 
  }
  arg1 = reinterpret_cast< PyTensorIndex * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt32)((PyTensorIndex const *)arg1)->__len__();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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_PyTensorIndex_begin__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  PyTensorIndex *arg1 = (PyTensorIndex *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::UInt32 *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PyTensorIndex, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PyTensorIndex_begin" "', argument " "1"" of type '" "PyTensorIndex const *""'"); 
  }
  arg1 = reinterpret_cast< PyTensorIndex * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt32 *)((PyTensorIndex 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_as_voidptr(result), SWIGTYPE_p_unsigned_int, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_PyTensorIndex_begin__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  PyTensorIndex *arg1 = (PyTensorIndex *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::UInt32 *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PyTensorIndex, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PyTensorIndex_begin" "', argument " "1"" of type '" "PyTensorIndex *""'"); 
  }
  arg1 = reinterpret_cast< PyTensorIndex * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt32 *)(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_as_voidptr(result), SWIGTYPE_p_unsigned_int, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_PyTensorIndex_begin(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[2];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"PyTensorIndex_begin",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_PyTensorIndex, 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_PyTensorIndex, 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_PyTensorIndex_begin__SWIG_1(self, argc, argv);
    case 2:
      return _wrap_PyTensorIndex_begin__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'PyTensorIndex_begin'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    PyTensorIndex::begin() const\n"
    "    PyTensorIndex::begin()\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_PyTensorIndex_end__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  PyTensorIndex *arg1 = (PyTensorIndex *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::UInt32 *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PyTensorIndex, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PyTensorIndex_end" "', argument " "1"" of type '" "PyTensorIndex const *""'"); 
  }
  arg1 = reinterpret_cast< PyTensorIndex * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt32 *)((PyTensorIndex 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_as_voidptr(result), SWIGTYPE_p_unsigned_int, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_PyTensorIndex_end__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  PyTensorIndex *arg1 = (PyTensorIndex *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::UInt32 *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PyTensorIndex, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PyTensorIndex_end" "', argument " "1"" of type '" "PyTensorIndex *""'"); 
  }
  arg1 = reinterpret_cast< PyTensorIndex * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt32 *)(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_as_voidptr(result), SWIGTYPE_p_unsigned_int, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_PyTensorIndex_end(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[2];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"PyTensorIndex_end",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_PyTensorIndex, 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_PyTensorIndex, 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_PyTensorIndex_end__SWIG_1(self, argc, argv);
    case 2:
      return _wrap_PyTensorIndex_end__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'PyTensorIndex_end'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    PyTensorIndex::end() const\n"
    "    PyTensorIndex::end()\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_PyTensorIndex___lt__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PyTensorIndex *arg1 = (PyTensorIndex *) 0 ;
  PyTensorIndex *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 *) "j", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:PyTensorIndex___lt__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PyTensorIndex, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PyTensorIndex___lt__" "', argument " "1"" of type '" "PyTensorIndex const *""'"); 
  }
  arg1 = reinterpret_cast< PyTensorIndex * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_PyTensorIndex,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PyTensorIndex___lt__" "', argument " "2"" of type '" "PyTensorIndex const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PyTensorIndex___lt__" "', argument " "2"" of type '" "PyTensorIndex const &""'"); 
  }
  arg2 = reinterpret_cast< PyTensorIndex * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((PyTensorIndex const *)arg1)->operator <((PyTensorIndex 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_PyTensorIndex___eq____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  PyTensorIndex *arg1 = (PyTensorIndex *) 0 ;
  PyTensorIndex *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  bool result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PyTensorIndex, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PyTensorIndex___eq__" "', argument " "1"" of type '" "PyTensorIndex const *""'"); 
  }
  arg1 = reinterpret_cast< PyTensorIndex * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_PyTensorIndex,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PyTensorIndex___eq__" "', argument " "2"" of type '" "PyTensorIndex const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PyTensorIndex___eq__" "', argument " "2"" of type '" "PyTensorIndex const &""'"); 
  }
  arg2 = reinterpret_cast< PyTensorIndex * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((PyTensorIndex const *)arg1)->__eq__((PyTensorIndex 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_PyTensorIndex___ne____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  PyTensorIndex *arg1 = (PyTensorIndex *) 0 ;
  PyTensorIndex *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  bool result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PyTensorIndex, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PyTensorIndex___ne__" "', argument " "1"" of type '" "PyTensorIndex const *""'"); 
  }
  arg1 = reinterpret_cast< PyTensorIndex * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_PyTensorIndex,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PyTensorIndex___ne__" "', argument " "2"" of type '" "PyTensorIndex const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PyTensorIndex___ne__" "', argument " "2"" of type '" "PyTensorIndex const &""'"); 
  }
  arg2 = reinterpret_cast< PyTensorIndex * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((PyTensorIndex const *)arg1)->__ne__((PyTensorIndex 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_PyTensorIndex___gt__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PyTensorIndex *arg1 = (PyTensorIndex *) 0 ;
  PyTensorIndex *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 *) "j", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:PyTensorIndex___gt__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PyTensorIndex, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PyTensorIndex___gt__" "', argument " "1"" of type '" "PyTensorIndex const *""'"); 
  }
  arg1 = reinterpret_cast< PyTensorIndex * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_PyTensorIndex,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PyTensorIndex___gt__" "', argument " "2"" of type '" "PyTensorIndex const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PyTensorIndex___gt__" "', argument " "2"" of type '" "PyTensorIndex const &""'"); 
  }
  arg2 = reinterpret_cast< PyTensorIndex * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((PyTensorIndex const *)arg1)->__gt__((PyTensorIndex 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_PyTensorIndex___eq____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  PyTensorIndex *arg1 = (PyTensorIndex *) 0 ;
  TIV *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  bool result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PyTensorIndex, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PyTensorIndex___eq__" "', argument " "1"" of type '" "PyTensorIndex const *""'"); 
  }
  arg1 = reinterpret_cast< PyTensorIndex * >(argp1);
  {
    std::vector<unsigned int,std::allocator< unsigned int > > *ptr = (std::vector<unsigned int,std::allocator< unsigned int > > *)0;
    res2 = swig::asptr(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PyTensorIndex___eq__" "', argument " "2"" of type '" "TIV const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PyTensorIndex___eq__" "', argument " "2"" of type '" "TIV const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((PyTensorIndex const *)arg1)->__eq__((TIV 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));
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_PyTensorIndex___eq__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"PyTensorIndex___eq__",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_PyTensorIndex, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_PyTensorIndex, 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_PyTensorIndex, 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 (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_PyTensorIndex___eq____SWIG_0(self, argc, argv);
    case 2:
      return _wrap_PyTensorIndex___eq____SWIG_1(self, argc, argv);
    }
  }
  
fail:
  Py_INCREF(Py_NotImplemented);
  return Py_NotImplemented;
}


SWIGINTERN PyObject *_wrap_PyTensorIndex___ne____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  PyTensorIndex *arg1 = (PyTensorIndex *) 0 ;
  TIV *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  bool result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PyTensorIndex, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PyTensorIndex___ne__" "', argument " "1"" of type '" "PyTensorIndex const *""'"); 
  }
  arg1 = reinterpret_cast< PyTensorIndex * >(argp1);
  {
    std::vector<unsigned int,std::allocator< unsigned int > > *ptr = (std::vector<unsigned int,std::allocator< unsigned int > > *)0;
    res2 = swig::asptr(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PyTensorIndex___ne__" "', argument " "2"" of type '" "TIV const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PyTensorIndex___ne__" "', argument " "2"" of type '" "TIV const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((PyTensorIndex const *)arg1)->__ne__((TIV 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));
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_PyTensorIndex___ne__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"PyTensorIndex___ne__",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_PyTensorIndex, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_PyTensorIndex, 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_PyTensorIndex, 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 (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_PyTensorIndex___ne____SWIG_0(self, argc, argv);
    case 2:
      return _wrap_PyTensorIndex___ne____SWIG_1(self, argc, argv);
    }
  }
  
fail:
  Py_INCREF(Py_NotImplemented);
  return Py_NotImplemented;
}


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


SWIGINTERN PyObject *_wrap_PyTensorIndex___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PyTensorIndex *arg1 = (PyTensorIndex *) 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 
  };
  TIV result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:PyTensorIndex___getslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PyTensorIndex, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PyTensorIndex___getslice__" "', argument " "1"" of type '" "PyTensorIndex const *""'"); 
  }
  arg1 = reinterpret_cast< PyTensorIndex * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "PyTensorIndex___getslice__" "', 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 '" "PyTensorIndex___getslice__" "', 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 = ((PyTensorIndex const *)arg1)->__getslice__(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_PyTensorIndex___setslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PyTensorIndex *arg1 = (PyTensorIndex *) 0 ;
  int arg2 ;
  int arg3 ;
  TIV *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int 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 *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:PyTensorIndex___setslice__",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PyTensorIndex, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PyTensorIndex___setslice__" "', argument " "1"" of type '" "PyTensorIndex *""'"); 
  }
  arg1 = reinterpret_cast< PyTensorIndex * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "PyTensorIndex___setslice__" "', 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 '" "PyTensorIndex___setslice__" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = static_cast< int >(val3);
  {
    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 '" "PyTensorIndex___setslice__" "', argument " "4"" of type '" "TIV const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PyTensorIndex___setslice__" "', argument " "4"" of type '" "TIV const &""'"); 
    }
    arg4 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->__setslice__(arg2,arg3,(TIV 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_PyTensorIndex_asTuple(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  PyTensorIndex *arg1 = (PyTensorIndex *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  TIV result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PyTensorIndex, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PyTensorIndex_asTuple" "', argument " "1"" of type '" "PyTensorIndex const *""'"); 
  }
  arg1 = reinterpret_cast< PyTensorIndex * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((PyTensorIndex const *)arg1)->asTuple();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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_PyTensorIndex___getstate__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  PyTensorIndex *arg1 = (PyTensorIndex *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  TIV result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PyTensorIndex, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PyTensorIndex___getstate__" "', argument " "1"" of type '" "PyTensorIndex const *""'"); 
  }
  arg1 = reinterpret_cast< PyTensorIndex * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((PyTensorIndex const *)arg1)->__getstate__();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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_delete_PyTensorIndex(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  PyTensorIndex *arg1 = (PyTensorIndex *) 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_PyTensorIndex, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_PyTensorIndex" "', argument " "1"" of type '" "PyTensorIndex *""'"); 
  }
  arg1 = reinterpret_cast< PyTensorIndex * >(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 *PyTensorIndex_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_PyTensorIndex, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_concatenate(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PyTensorIndex *arg1 = 0 ;
  PyTensorIndex *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "i1",(char *) "i2", NULL 
  };
  PyTensorIndex result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:concatenate",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_PyTensorIndex,  0  | 0);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "concatenate" "', argument " "1"" of type '" "PyTensorIndex const &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "concatenate" "', argument " "1"" of type '" "PyTensorIndex const &""'"); 
  }
  arg1 = reinterpret_cast< PyTensorIndex * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_PyTensorIndex,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "concatenate" "', argument " "2"" of type '" "PyTensorIndex const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "concatenate" "', argument " "2"" of type '" "PyTensorIndex const &""'"); 
  }
  arg2 = reinterpret_cast< PyTensorIndex * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = concatenate((PyTensorIndex const &)*arg1,(PyTensorIndex 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 PyTensorIndex(static_cast< const PyTensorIndex& >(result))), SWIGTYPE_p_PyTensorIndex, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_PyDomain__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  TIV *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  PyDomain *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) 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_PyDomain" "', argument " "1"" of type '" "TIV const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_PyDomain" "', argument " "1"" of type '" "TIV const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyDomain *)new PyDomain((TIV 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_PyDomain, 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_PyDomain__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  TIV *arg1 = 0 ;
  TIV *arg2 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  int res2 = SWIG_OLDOBJ ;
  PyDomain *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) 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_PyDomain" "', argument " "1"" of type '" "TIV const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_PyDomain" "', argument " "1"" of type '" "TIV const &""'"); 
    }
    arg1 = ptr;
  }
  {
    std::vector<unsigned int,std::allocator< unsigned int > > *ptr = (std::vector<unsigned int,std::allocator< unsigned int > > *)0;
    res2 = swig::asptr(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_PyDomain" "', argument " "2"" of type '" "TIV const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_PyDomain" "', argument " "2"" of type '" "TIV const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyDomain *)new PyDomain((TIV const &)*arg1,(TIV 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_PyDomain, SWIG_POINTER_NEW |  0 );
  if (SWIG_IsNewObj(res1)) delete arg1;
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_PyDomain(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_PyDomain",0,2,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;
      {
        int res = swig::asptr(argv[0], (std::vector<unsigned int,std::allocator< 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;
      {
        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 (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_new_PyDomain__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_PyDomain__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_PyDomain'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    PyDomain::PyDomain(TIV const &)\n"
    "    PyDomain::PyDomain(TIV const &,TIV const &)\n");
  return 0;
}


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


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


SWIGINTERN PyObject *_wrap_PyDomain___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PyDomain *arg1 = (PyDomain *) 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 
  };
  std::vector< nupic::UInt32,std::allocator< nupic::UInt32 > > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:PyDomain___getitem__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PyDomain, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PyDomain___getitem__" "', argument " "1"" of type '" "PyDomain const *""'"); 
  }
  arg1 = reinterpret_cast< PyDomain * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "PyDomain___getitem__" "', 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 = ((PyDomain const *)arg1)->__getitem__(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_PyDomain_getDimensions(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  PyDomain *arg1 = (PyDomain *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyTensorIndex result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PyDomain, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PyDomain_getDimensions" "', argument " "1"" of type '" "PyDomain const *""'"); 
  }
  arg1 = reinterpret_cast< PyDomain * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((PyDomain const *)arg1)->getDimensions();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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 PyTensorIndex(static_cast< const PyTensorIndex& >(result))), SWIGTYPE_p_PyTensorIndex, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


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


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


SWIGINTERN PyObject *_wrap_PyDomain_doesInclude(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PyDomain *arg1 = (PyDomain *) 0 ;
  TIV *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:PyDomain_doesInclude",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PyDomain, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PyDomain_doesInclude" "', argument " "1"" of type '" "PyDomain const *""'"); 
  }
  arg1 = reinterpret_cast< PyDomain * >(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 '" "PyDomain_doesInclude" "', argument " "2"" of type '" "TIV const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PyDomain_doesInclude" "', argument " "2"" of type '" "TIV const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((PyDomain const *)arg1)->doesInclude((TIV 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));
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


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


SWIGINTERN PyObject *_wrap_delete_PyDomain(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  PyDomain *arg1 = (PyDomain *) 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_PyDomain, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_PyDomain" "', argument " "1"" of type '" "PyDomain *""'"); 
  }
  arg1 = reinterpret_cast< PyDomain * >(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 *PyDomain_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_PyDomain, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new_PySparseTensor__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::string *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  PySparseTensor *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(swig_obj[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_PySparseTensor" "', argument " "1"" of type '" "std::string const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_PySparseTensor" "', argument " "1"" of type '" "std::string const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PySparseTensor *)new PySparseTensor((std::string 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_PySparseTensor, 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_PySparseTensor__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  TIV *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  PySparseTensor *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) 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_PySparseTensor" "', argument " "1"" of type '" "TIV const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_PySparseTensor" "', argument " "1"" of type '" "TIV const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PySparseTensor *)new PySparseTensor((TIV 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_PySparseTensor, 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_PySparseTensor__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  PyTensorIndex *arg1 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PySparseTensor *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_PyTensorIndex,  0  | 0);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_PySparseTensor" "', argument " "1"" of type '" "PyTensorIndex const &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_PySparseTensor" "', argument " "1"" of type '" "PyTensorIndex const &""'"); 
  }
  arg1 = reinterpret_cast< PyTensorIndex * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PySparseTensor *)new PySparseTensor((PyTensorIndex 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_PySparseTensor, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_PySparseTensor__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PySparseTensor *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  arg1 = swig_obj[0];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PySparseTensor *)new PySparseTensor(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_PySparseTensor, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_PySparseTensor(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[2];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_PySparseTensor",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;
      {
        int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_PyTensorIndex, 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;
      {
        int res = SWIG_AsPtr_std_string(argv[0], (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:
    
    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<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 (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 3;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_3:
    
    if (argc == 1) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        _v = (argv[0] != 0);
      }
      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_PySparseTensor__SWIG_2(self, argc, argv);
    case 2:
      return _wrap_new_PySparseTensor__SWIG_0(self, argc, argv);
    case 3:
      return _wrap_new_PySparseTensor__SWIG_1(self, argc, argv);
    case 4:
      return _wrap_new_PySparseTensor__SWIG_3(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_PySparseTensor'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    PySparseTensor::PySparseTensor(std::string const &)\n"
    "    PySparseTensor::PySparseTensor(TIV const &)\n"
    "    PySparseTensor::PySparseTensor(PyTensorIndex const &)\n"
    "    PySparseTensor::PySparseTensor(PyObject *)\n");
  return 0;
}


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


SWIGINTERN PyObject *_wrap_PySparseTensor_getBound(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  nupic::UInt32 arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "dim", NULL 
  };
  nupic::UInt32 result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:PySparseTensor_getBound",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_getBound" "', argument " "1"" of type '" "PySparseTensor const *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt32)((PySparseTensor const *)arg1)->getBound(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_PySparseTensor_get__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  TIV *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  nupic::Real result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_get" "', argument " "1"" of type '" "PySparseTensor const *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  {
    std::vector<unsigned int,std::allocator< unsigned int > > *ptr = (std::vector<unsigned int,std::allocator< unsigned int > > *)0;
    res2 = swig::asptr(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySparseTensor_get" "', argument " "2"" of type '" "TIV const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor_get" "', argument " "2"" of type '" "TIV const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real)((PySparseTensor const *)arg1)->get((TIV 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_float(static_cast< float >(result));
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_PySparseTensor_get__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  PyTensorIndex *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  nupic::Real result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_get" "', argument " "1"" of type '" "PySparseTensor const *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_PyTensorIndex,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySparseTensor_get" "', argument " "2"" of type '" "PyTensorIndex const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor_get" "', argument " "2"" of type '" "PyTensorIndex const &""'"); 
  }
  arg2 = reinterpret_cast< PyTensorIndex * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real)((PySparseTensor const *)arg1)->get((PyTensorIndex 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_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_PySparseTensor_get(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"PySparseTensor_get",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_PySparseTensor, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_PyTensorIndex, 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_PySparseTensor, 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 (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_PySparseTensor_get__SWIG_1(self, argc, argv);
    case 2:
      return _wrap_PySparseTensor_get__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'PySparseTensor_get'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    PySparseTensor::get(TIV const &) const\n"
    "    PySparseTensor::get(PyTensorIndex const &) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_PySparseTensor_set__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  TIV *arg2 = 0 ;
  nupic::Real arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_set" "', argument " "1"" of type '" "PySparseTensor *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  {
    std::vector<unsigned int,std::allocator< unsigned int > > *ptr = (std::vector<unsigned int,std::allocator< unsigned int > > *)0;
    res2 = swig::asptr(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySparseTensor_set" "', argument " "2"" of type '" "TIV const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor_set" "', argument " "2"" of type '" "TIV const &""'"); 
    }
    arg2 = ptr;
  }
  {
    arg3 = (nupic::Real32) PyFloat_AsDouble(swig_obj[2]);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->set((TIV 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_PySparseTensor_set__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  PyTensorIndex *arg2 = 0 ;
  nupic::Real arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_set" "', argument " "1"" of type '" "PySparseTensor *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_PyTensorIndex,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySparseTensor_set" "', argument " "2"" of type '" "PyTensorIndex const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor_set" "', argument " "2"" of type '" "PyTensorIndex const &""'"); 
  }
  arg2 = reinterpret_cast< PyTensorIndex * >(argp2);
  {
    arg3 = (nupic::Real32) PyFloat_AsDouble(swig_obj[2]);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->set((PyTensorIndex 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_PySparseTensor_set__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  TIV *arg2 = 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_set" "', argument " "1"" of type '" "PySparseTensor *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  {
    std::vector<unsigned int,std::allocator< unsigned int > > *ptr = (std::vector<unsigned int,std::allocator< unsigned int > > *)0;
    res2 = swig::asptr(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySparseTensor_set" "', argument " "2"" of type '" "TIV const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor_set" "', argument " "2"" of type '" "TIV const &""'"); 
    }
    arg2 = ptr;
  }
  arg3 = swig_obj[2];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->set((TIV 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_PySparseTensor_set__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  PyTensorIndex *arg2 = 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_set" "', argument " "1"" of type '" "PySparseTensor *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_PyTensorIndex,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySparseTensor_set" "', argument " "2"" of type '" "PyTensorIndex const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor_set" "', argument " "2"" of type '" "PyTensorIndex const &""'"); 
  }
  arg2 = reinterpret_cast< PyTensorIndex * >(argp2);
  arg3 = swig_obj[2];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->set((PyTensorIndex 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_PySparseTensor_set(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"PySparseTensor_set",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_PySparseTensor, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_PyTensorIndex, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_float(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_PySparseTensor, 0);
        _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_PyTensorIndex, 0);
        _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:
    
    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_PySparseTensor, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_3;
      _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_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_float(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:
    
    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_PySparseTensor, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_4;
      _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_4;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[2] != 0);
      }
      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_PySparseTensor_set__SWIG_1(self, argc, argv);
    case 2:
      return _wrap_PySparseTensor_set__SWIG_3(self, argc, argv);
    case 3:
      return _wrap_PySparseTensor_set__SWIG_0(self, argc, argv);
    case 4:
      return _wrap_PySparseTensor_set__SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'PySparseTensor_set'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    PySparseTensor::set(TIV const &,nupic::Real)\n"
    "    PySparseTensor::set(PyTensorIndex const &,nupic::Real)\n"
    "    PySparseTensor::set(TIV const &,PyObject *)\n"
    "    PySparseTensor::set(PyTensorIndex const &,PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_PySparseTensor_getNNonZeros(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt32 result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_getNNonZeros" "', argument " "1"" of type '" "PySparseTensor const *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt32)((PySparseTensor const *)arg1)->getNNonZeros();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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_PySparseTensor_nNonZeros(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt32 result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_nNonZeros" "', argument " "1"" of type '" "PySparseTensor const *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt32)((PySparseTensor const *)arg1)->nNonZeros();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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_PySparseTensor_reshape(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  TIV *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "dims", NULL 
  };
  SwigValueWrapper< PySparseTensor > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:PySparseTensor_reshape",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_reshape" "', argument " "1"" of type '" "PySparseTensor const *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(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 '" "PySparseTensor_reshape" "', argument " "2"" of type '" "TIV const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor_reshape" "', argument " "2"" of type '" "TIV const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((PySparseTensor const *)arg1)->reshape((TIV 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 PySparseTensor(static_cast< const PySparseTensor& >(result))), SWIGTYPE_p_PySparseTensor, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_PySparseTensor_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  TIV *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_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_resize" "', argument " "1"" of type '" "PySparseTensor *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  {
    std::vector<unsigned int,std::allocator< unsigned int > > *ptr = (std::vector<unsigned int,std::allocator< unsigned int > > *)0;
    res2 = swig::asptr(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySparseTensor_resize" "', argument " "2"" of type '" "TIV const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor_resize" "', argument " "2"" of type '" "TIV const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resize((TIV 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_PySparseTensor_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  PyTensorIndex *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_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_resize" "', argument " "1"" of type '" "PySparseTensor *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_PyTensorIndex,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySparseTensor_resize" "', argument " "2"" of type '" "PyTensorIndex const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor_resize" "', argument " "2"" of type '" "PyTensorIndex const &""'"); 
  }
  arg2 = reinterpret_cast< PyTensorIndex * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resize((PyTensorIndex 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_PySparseTensor_resize(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"PySparseTensor_resize",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_PySparseTensor, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_PyTensorIndex, 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_PySparseTensor, 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 (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_PySparseTensor_resize__SWIG_1(self, argc, argv);
    case 2:
      return _wrap_PySparseTensor_resize__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'PySparseTensor_resize'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    PySparseTensor::resize(TIV const &)\n"
    "    PySparseTensor::resize(PyTensorIndex const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_PySparseTensor_extract(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  nupic::UInt32 arg2 ;
  TIV *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "dim",(char *) "ind", NULL 
  };
  SwigValueWrapper< PySparseTensor > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:PySparseTensor_extract",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_extract" "', argument " "1"" of type '" "PySparseTensor const *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(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 '" "PySparseTensor_extract" "', argument " "3"" of type '" "TIV const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor_extract" "', argument " "3"" of type '" "TIV const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((PySparseTensor const *)arg1)->extract(arg2,(TIV 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((new PySparseTensor(static_cast< const PySparseTensor& >(result))), SWIGTYPE_p_PySparseTensor, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_PySparseTensor_reduce(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  nupic::UInt32 arg2 ;
  TIV *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "dim",(char *) "ind", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:PySparseTensor_reduce",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_reduce" "', argument " "1"" of type '" "PySparseTensor *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(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 '" "PySparseTensor_reduce" "', argument " "3"" of type '" "TIV const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor_reduce" "', argument " "3"" of type '" "TIV const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->reduce(arg2,(TIV 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();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_PySparseTensor_getSlice(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  PyDomain *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 *) "range", NULL 
  };
  SwigValueWrapper< PySparseTensor > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:PySparseTensor_getSlice",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_getSlice" "', argument " "1"" of type '" "PySparseTensor const *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_PyDomain,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySparseTensor_getSlice" "', argument " "2"" of type '" "PyDomain const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor_getSlice" "', argument " "2"" of type '" "PyDomain const &""'"); 
  }
  arg2 = reinterpret_cast< PyDomain * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((PySparseTensor const *)arg1)->getSlice((PyDomain 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 PySparseTensor(static_cast< const PySparseTensor& >(result))), SWIGTYPE_p_PySparseTensor, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_PySparseTensor_setSlice(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  PyDomain *arg2 = 0 ;
  PySparseTensor *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 *) "range",(char *) "slice", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:PySparseTensor_setSlice",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_setSlice" "', argument " "1"" of type '" "PySparseTensor *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_PyDomain,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySparseTensor_setSlice" "', argument " "2"" of type '" "PyDomain const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor_setSlice" "', argument " "2"" of type '" "PyDomain const &""'"); 
  }
  arg2 = reinterpret_cast< PyDomain * >(argp2);
  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_PySparseTensor,  0  | 0);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "PySparseTensor_setSlice" "', argument " "3"" of type '" "PySparseTensor const &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor_setSlice" "', argument " "3"" of type '" "PySparseTensor const &""'"); 
  }
  arg3 = reinterpret_cast< PySparseTensor * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setSlice((PyDomain const &)*arg2,(PySparseTensor 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_PySparseTensor_setZero(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  PyDomain *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 *) "range", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:PySparseTensor_setZero",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_setZero" "', argument " "1"" of type '" "PySparseTensor *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_PyDomain,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySparseTensor_setZero" "', argument " "2"" of type '" "PyDomain const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor_setZero" "', argument " "2"" of type '" "PyDomain const &""'"); 
  }
  arg2 = reinterpret_cast< PyDomain * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setZero((PyDomain 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_PySparseTensor_addSlice(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  nupic::UInt32 arg2 ;
  nupic::UInt32 arg3 ;
  nupic::UInt32 arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "which",(char *) "src",(char *) "dst", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:PySparseTensor_addSlice",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_addSlice" "', argument " "1"" of type '" "PySparseTensor *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(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
    {
      (arg1)->addSlice(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_PySparseTensor_factorMultiply__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  TIV *arg2 = 0 ;
  PySparseTensor *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  SwigValueWrapper< PySparseTensor > result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_factorMultiply" "', argument " "1"" of type '" "PySparseTensor const *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  {
    std::vector<unsigned int,std::allocator< unsigned int > > *ptr = (std::vector<unsigned int,std::allocator< unsigned int > > *)0;
    res2 = swig::asptr(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySparseTensor_factorMultiply" "', argument " "2"" of type '" "TIV const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor_factorMultiply" "', argument " "2"" of type '" "TIV const &""'"); 
    }
    arg2 = ptr;
  }
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_PySparseTensor,  0  | 0);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "PySparseTensor_factorMultiply" "', argument " "3"" of type '" "PySparseTensor const &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor_factorMultiply" "', argument " "3"" of type '" "PySparseTensor const &""'"); 
  }
  arg3 = reinterpret_cast< PySparseTensor * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((PySparseTensor const *)arg1)->factorMultiply((TIV const &)*arg2,(PySparseTensor 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((new PySparseTensor(static_cast< const PySparseTensor& >(result))), SWIGTYPE_p_PySparseTensor, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_PySparseTensor_factorMultiply__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  PyTensorIndex *arg2 = 0 ;
  PySparseTensor *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  SwigValueWrapper< PySparseTensor > result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_factorMultiply" "', argument " "1"" of type '" "PySparseTensor const *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_PyTensorIndex,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySparseTensor_factorMultiply" "', argument " "2"" of type '" "PyTensorIndex const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor_factorMultiply" "', argument " "2"" of type '" "PyTensorIndex const &""'"); 
  }
  arg2 = reinterpret_cast< PyTensorIndex * >(argp2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_PySparseTensor,  0  | 0);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "PySparseTensor_factorMultiply" "', argument " "3"" of type '" "PySparseTensor const &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor_factorMultiply" "', argument " "3"" of type '" "PySparseTensor const &""'"); 
  }
  arg3 = reinterpret_cast< PySparseTensor * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((PySparseTensor const *)arg1)->factorMultiply((PyTensorIndex const &)*arg2,(PySparseTensor 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((new PySparseTensor(static_cast< const PySparseTensor& >(result))), SWIGTYPE_p_PySparseTensor, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_PySparseTensor_factorMultiply(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"PySparseTensor_factorMultiply",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_PySparseTensor, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_PyTensorIndex, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_PySparseTensor, 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_PySparseTensor, 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;
      {
        int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_PySparseTensor, 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_PySparseTensor_factorMultiply__SWIG_1(self, argc, argv);
    case 2:
      return _wrap_PySparseTensor_factorMultiply__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'PySparseTensor_factorMultiply'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    PySparseTensor::factorMultiply(TIV const &,PySparseTensor const &) const\n"
    "    PySparseTensor::factorMultiply(PyTensorIndex const &,PySparseTensor const &) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_PySparseTensor_outerProduct(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  PySparseTensor *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 *) "B", NULL 
  };
  SwigValueWrapper< PySparseTensor > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:PySparseTensor_outerProduct",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_outerProduct" "', argument " "1"" of type '" "PySparseTensor const *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_PySparseTensor,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySparseTensor_outerProduct" "', argument " "2"" of type '" "PySparseTensor const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor_outerProduct" "', argument " "2"" of type '" "PySparseTensor const &""'"); 
  }
  arg2 = reinterpret_cast< PySparseTensor * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((PySparseTensor const *)arg1)->outerProduct((PySparseTensor 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 PySparseTensor(static_cast< const PySparseTensor& >(result))), SWIGTYPE_p_PySparseTensor, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_PySparseTensor_innerProduct(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  nupic::UInt32 arg2 ;
  nupic::UInt32 arg3 ;
  PySparseTensor *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 *) "dim1",(char *) "dim2",(char *) "B", NULL 
  };
  SwigValueWrapper< PySparseTensor > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:PySparseTensor_innerProduct",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_innerProduct" "', argument " "1"" of type '" "PySparseTensor const *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    arg3 = (nupic::UInt32) PyLong_AsLong(obj2);
  }
  res4 = SWIG_ConvertPtr(obj3, &argp4, SWIGTYPE_p_PySparseTensor,  0  | 0);
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "PySparseTensor_innerProduct" "', argument " "4"" of type '" "PySparseTensor const &""'"); 
  }
  if (!argp4) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor_innerProduct" "', argument " "4"" of type '" "PySparseTensor const &""'"); 
  }
  arg4 = reinterpret_cast< PySparseTensor * >(argp4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((PySparseTensor const *)arg1)->innerProduct(arg2,arg3,(PySparseTensor 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_NewPointerObj((new PySparseTensor(static_cast< const PySparseTensor& >(result))), SWIGTYPE_p_PySparseTensor, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_PySparseTensor___add__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  PySparseTensor *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 *) "B", NULL 
  };
  SwigValueWrapper< PySparseTensor > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:PySparseTensor___add__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor___add__" "', argument " "1"" of type '" "PySparseTensor const *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_PySparseTensor,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySparseTensor___add__" "', argument " "2"" of type '" "PySparseTensor const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor___add__" "', argument " "2"" of type '" "PySparseTensor const &""'"); 
  }
  arg2 = reinterpret_cast< PySparseTensor * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((PySparseTensor const *)arg1)->__add__((PySparseTensor 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 PySparseTensor(static_cast< const PySparseTensor& >(result))), SWIGTYPE_p_PySparseTensor, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_PySparseTensor___sub__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  PySparseTensor *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 *) "B", NULL 
  };
  SwigValueWrapper< PySparseTensor > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:PySparseTensor___sub__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor___sub__" "', argument " "1"" of type '" "PySparseTensor const *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_PySparseTensor,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySparseTensor___sub__" "', argument " "2"" of type '" "PySparseTensor const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor___sub__" "', argument " "2"" of type '" "PySparseTensor const &""'"); 
  }
  arg2 = reinterpret_cast< PySparseTensor * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((PySparseTensor const *)arg1)->__sub__((PySparseTensor 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 PySparseTensor(static_cast< const PySparseTensor& >(result))), SWIGTYPE_p_PySparseTensor, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_PySparseTensor_factorAdd__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  TIV *arg2 = 0 ;
  PySparseTensor *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  SwigValueWrapper< PySparseTensor > result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_factorAdd" "', argument " "1"" of type '" "PySparseTensor const *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  {
    std::vector<unsigned int,std::allocator< unsigned int > > *ptr = (std::vector<unsigned int,std::allocator< unsigned int > > *)0;
    res2 = swig::asptr(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySparseTensor_factorAdd" "', argument " "2"" of type '" "TIV const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor_factorAdd" "', argument " "2"" of type '" "TIV const &""'"); 
    }
    arg2 = ptr;
  }
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_PySparseTensor,  0  | 0);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "PySparseTensor_factorAdd" "', argument " "3"" of type '" "PySparseTensor const &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor_factorAdd" "', argument " "3"" of type '" "PySparseTensor const &""'"); 
  }
  arg3 = reinterpret_cast< PySparseTensor * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((PySparseTensor const *)arg1)->factorAdd((TIV const &)*arg2,(PySparseTensor 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((new PySparseTensor(static_cast< const PySparseTensor& >(result))), SWIGTYPE_p_PySparseTensor, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_PySparseTensor_factorAdd__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  PyTensorIndex *arg2 = 0 ;
  PySparseTensor *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  SwigValueWrapper< PySparseTensor > result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_factorAdd" "', argument " "1"" of type '" "PySparseTensor const *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_PyTensorIndex,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySparseTensor_factorAdd" "', argument " "2"" of type '" "PyTensorIndex const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor_factorAdd" "', argument " "2"" of type '" "PyTensorIndex const &""'"); 
  }
  arg2 = reinterpret_cast< PyTensorIndex * >(argp2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_PySparseTensor,  0  | 0);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "PySparseTensor_factorAdd" "', argument " "3"" of type '" "PySparseTensor const &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor_factorAdd" "', argument " "3"" of type '" "PySparseTensor const &""'"); 
  }
  arg3 = reinterpret_cast< PySparseTensor * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((PySparseTensor const *)arg1)->factorAdd((PyTensorIndex const &)*arg2,(PySparseTensor 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((new PySparseTensor(static_cast< const PySparseTensor& >(result))), SWIGTYPE_p_PySparseTensor, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_PySparseTensor_factorAdd(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"PySparseTensor_factorAdd",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_PySparseTensor, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_PyTensorIndex, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_PySparseTensor, 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_PySparseTensor, 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;
      {
        int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_PySparseTensor, 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_PySparseTensor_factorAdd__SWIG_1(self, argc, argv);
    case 2:
      return _wrap_PySparseTensor_factorAdd__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'PySparseTensor_factorAdd'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    PySparseTensor::factorAdd(TIV const &,PySparseTensor const &) const\n"
    "    PySparseTensor::factorAdd(PyTensorIndex const &,PySparseTensor const &) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_PySparseTensor_getComplementBounds(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  PyTensorIndex *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 *) "dims", NULL 
  };
  SwigValueWrapper< PySparseTensor > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:PySparseTensor_getComplementBounds",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_getComplementBounds" "', argument " "1"" of type '" "PySparseTensor const *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_PyTensorIndex,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySparseTensor_getComplementBounds" "', argument " "2"" of type '" "PyTensorIndex const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor_getComplementBounds" "', argument " "2"" of type '" "PyTensorIndex const &""'"); 
  }
  arg2 = reinterpret_cast< PyTensorIndex * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((PySparseTensor const *)arg1)->getComplementBounds((PyTensorIndex 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 PySparseTensor(static_cast< const PySparseTensor& >(result))), SWIGTYPE_p_PySparseTensor, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_PySparseTensor___mul__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  nupic::Real *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::Real temp2 ;
  float val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  SwigValueWrapper< PySparseTensor > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:PySparseTensor___mul__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor___mul__" "', argument " "1"" of type '" "PySparseTensor const *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  ecode2 = SWIG_AsVal_float(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "PySparseTensor___mul__" "', argument " "2"" of type '" "nupic::Real""'");
  } 
  temp2 = static_cast< nupic::Real >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((PySparseTensor const *)arg1)->__mul__((nupic::Real 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 PySparseTensor(static_cast< const PySparseTensor& >(result))), SWIGTYPE_p_PySparseTensor, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


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


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


SWIGINTERN PyObject *_wrap_PySparseTensor_marginalize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  TIV *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  SwigValueWrapper< PySparseTensor > result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_marginalize" "', argument " "1"" of type '" "PySparseTensor const *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  {
    std::vector<unsigned int,std::allocator< unsigned int > > *ptr = (std::vector<unsigned int,std::allocator< unsigned int > > *)0;
    res2 = swig::asptr(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySparseTensor_marginalize" "', argument " "2"" of type '" "TIV const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor_marginalize" "', argument " "2"" of type '" "TIV const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((PySparseTensor const *)arg1)->marginalize((TIV 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 PySparseTensor(static_cast< const PySparseTensor& >(result))), SWIGTYPE_p_PySparseTensor, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_PySparseTensor_marginalize__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  PyTensorIndex *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  SwigValueWrapper< PySparseTensor > result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_marginalize" "', argument " "1"" of type '" "PySparseTensor const *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_PyTensorIndex,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySparseTensor_marginalize" "', argument " "2"" of type '" "PyTensorIndex const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor_marginalize" "', argument " "2"" of type '" "PyTensorIndex const &""'"); 
  }
  arg2 = reinterpret_cast< PyTensorIndex * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((PySparseTensor const *)arg1)->marginalize((PyTensorIndex 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 PySparseTensor(static_cast< const PySparseTensor& >(result))), SWIGTYPE_p_PySparseTensor, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_PySparseTensor_marginalize(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"PySparseTensor_marginalize",0,2,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_PySparseTensor, 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_PySparseTensor, 0);
        _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_PyTensorIndex, 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_PySparseTensor, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_3;
      _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_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_PySparseTensor_marginalize__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_PySparseTensor_marginalize__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_PySparseTensor_marginalize__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'PySparseTensor_marginalize'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    PySparseTensor::marginalize() const\n"
    "    PySparseTensor::marginalize(TIV const &) const\n"
    "    PySparseTensor::marginalize(PyTensorIndex const &) const\n");
  return 0;
}


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


SWIGINTERN PyObject *_wrap_PySparseTensor_max__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::Real result;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_max" "', argument " "1"" of type '" "PySparseTensor const *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real)((PySparseTensor const *)arg1)->max();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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_PySparseTensor_max__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  TIV *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  SwigValueWrapper< PySparseTensor > result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_max" "', argument " "1"" of type '" "PySparseTensor const *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  {
    std::vector<unsigned int,std::allocator< unsigned int > > *ptr = (std::vector<unsigned int,std::allocator< unsigned int > > *)0;
    res2 = swig::asptr(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySparseTensor_max" "', argument " "2"" of type '" "TIV const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor_max" "', argument " "2"" of type '" "TIV const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((PySparseTensor const *)arg1)->max((TIV 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 PySparseTensor(static_cast< const PySparseTensor& >(result))), SWIGTYPE_p_PySparseTensor, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_PySparseTensor_max__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  PyTensorIndex *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  SwigValueWrapper< PySparseTensor > result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_max" "', argument " "1"" of type '" "PySparseTensor const *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_PyTensorIndex,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySparseTensor_max" "', argument " "2"" of type '" "PyTensorIndex const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor_max" "', argument " "2"" of type '" "PyTensorIndex const &""'"); 
  }
  arg2 = reinterpret_cast< PyTensorIndex * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((PySparseTensor const *)arg1)->max((PyTensorIndex 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 PySparseTensor(static_cast< const PySparseTensor& >(result))), SWIGTYPE_p_PySparseTensor, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_PySparseTensor_max(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"PySparseTensor_max",0,2,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_PySparseTensor, 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_PySparseTensor, 0);
        _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_PyTensorIndex, 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_PySparseTensor, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_3;
      _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_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_PySparseTensor_max__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_PySparseTensor_max__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_PySparseTensor_max__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'PySparseTensor_max'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    PySparseTensor::max() const\n"
    "    PySparseTensor::max(TIV const &) const\n"
    "    PySparseTensor::max(PyTensorIndex const &) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_PySparseTensor_tolist(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 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_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_tolist" "', argument " "1"" of type '" "PySparseTensor const *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)((PySparseTensor const *)arg1)->tolist();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't 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_PySparseTensor___eq__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  PySparseTensor *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 *) "B", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:PySparseTensor___eq__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor___eq__" "', argument " "1"" of type '" "PySparseTensor const *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_PySparseTensor,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySparseTensor___eq__" "', argument " "2"" of type '" "PySparseTensor const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor___eq__" "', argument " "2"" of type '" "PySparseTensor const &""'"); 
  }
  arg2 = reinterpret_cast< PySparseTensor * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((PySparseTensor const *)arg1)->__eq__((PySparseTensor 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_PySparseTensor___ne__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  PySparseTensor *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 *) "B", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:PySparseTensor___ne__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor___ne__" "', argument " "1"" of type '" "PySparseTensor const *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_PySparseTensor,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySparseTensor___ne__" "', argument " "2"" of type '" "PySparseTensor const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySparseTensor___ne__" "', argument " "2"" of type '" "PySparseTensor const &""'"); 
  }
  arg2 = reinterpret_cast< PySparseTensor * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((PySparseTensor const *)arg1)->__ne__((PySparseTensor 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_PySparseTensor_toDense(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 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_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor_toDense" "', argument " "1"" of type '" "PySparseTensor const *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)((PySparseTensor const *)arg1)->toDense();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't 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_PySparseTensor___str__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 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_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor___str__" "', argument " "1"" of type '" "PySparseTensor const *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)((PySparseTensor const *)arg1)->__str__();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't 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_PySparseTensor___getstate__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::string result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PySparseTensor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySparseTensor___getstate__" "', argument " "1"" of type '" "PySparseTensor const *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((PySparseTensor const *)arg1)->__getstate__();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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_std_string(static_cast< std::string >(result));
  return resultobj;
fail:
  return NULL;
}


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


SWIGINTERN PyObject *_wrap_delete_PySparseTensor(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  PySparseTensor *arg1 = (PySparseTensor *) 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_PySparseTensor, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_PySparseTensor" "', argument " "1"" of type '" "PySparseTensor *""'"); 
  }
  arg1 = reinterpret_cast< PySparseTensor * >(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 *PySparseTensor_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_PySparseTensor, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_lgamma(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::Real64 arg1 ;
  double val1 ;
  int ecode1 = 0 ;
  PyObject * obj0 = 0 ;
  char *  kwnames[] = {
    (char *) "x", NULL 
  };
  nupic::Real64 result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:lgamma",kwnames,&obj0)) SWIG_fail;
  ecode1 = SWIG_AsVal_double(obj0, &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "lgamma" "', argument " "1"" of type '" "nupic::Real64""'");
  } 
  arg1 = static_cast< nupic::Real64 >(val1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real64)lgamma(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_double(static_cast< double >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_digamma(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::Real64 arg1 ;
  double val1 ;
  int ecode1 = 0 ;
  PyObject * obj0 = 0 ;
  char *  kwnames[] = {
    (char *) "x", NULL 
  };
  nupic::Real64 result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:digamma",kwnames,&obj0)) SWIG_fail;
  ecode1 = SWIG_AsVal_double(obj0, &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "digamma" "', argument " "1"" of type '" "nupic::Real64""'");
  } 
  arg1 = static_cast< nupic::Real64 >(val1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real64)digamma(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_double(static_cast< double >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_beta(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::Real64 arg1 ;
  nupic::Real64 arg2 ;
  double val1 ;
  int ecode1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "x",(char *) "y", NULL 
  };
  nupic::Real64 result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:beta",kwnames,&obj0,&obj1)) SWIG_fail;
  ecode1 = SWIG_AsVal_double(obj0, &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "beta" "', argument " "1"" of type '" "nupic::Real64""'");
  } 
  arg1 = static_cast< nupic::Real64 >(val1);
  ecode2 = SWIG_AsVal_double(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "beta" "', argument " "2"" of type '" "nupic::Real64""'");
  } 
  arg2 = static_cast< nupic::Real64 >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real64)beta(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_double(static_cast< double >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_erf(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::Real64 arg1 ;
  double val1 ;
  int ecode1 = 0 ;
  PyObject * obj0 = 0 ;
  char *  kwnames[] = {
    (char *) "x", NULL 
  };
  nupic::Real64 result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:erf",kwnames,&obj0)) SWIG_fail;
  ecode1 = SWIG_AsVal_double(obj0, &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "erf" "', argument " "1"" of type '" "nupic::Real64""'");
  } 
  arg1 = static_cast< nupic::Real64 >(val1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real64)erf(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_double(static_cast< double >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_nearlyZeroRange(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  nupic::Real32 arg2 = (nupic::Real32) nupic::Epsilon ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "py_x",(char *) "eps", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:nearlyZeroRange",kwnames,&obj0,&obj1)) SWIG_fail;
  arg1 = obj0;
  if (obj1) {
    {
      arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)nearlyZeroRange(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_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_nearlyEqualRange(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  nupic::Real32 arg3 = (nupic::Real32) nupic::Epsilon ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "py_x",(char *) "py_y",(char *) "eps", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|O:nearlyEqualRange",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  arg1 = obj0;
  arg2 = obj1;
  if (obj2) {
    {
      arg3 = (nupic::Real32) PyFloat_AsDouble(obj2);
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)nearlyEqualRange(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_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_positive_less_than(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  nupic::Real32 arg2 = (nupic::Real32) nupic::Epsilon ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "py_x",(char *) "eps", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:positive_less_than",kwnames,&obj0,&obj1)) SWIG_fail;
  arg1 = obj0;
  if (obj1) {
    {
      arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)positive_less_than(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_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_winnerTakesAll_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  size_t arg1 ;
  size_t arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  size_t val1 ;
  int ecode1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "k",(char *) "seg_size",(char *) "py_x", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:winnerTakesAll_3",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  ecode1 = SWIG_AsVal_size_t(obj0, &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "winnerTakesAll_3" "', argument " "1"" of type '" "size_t""'");
  } 
  arg1 = static_cast< size_t >(val1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "winnerTakesAll_3" "', argument " "2"" of type '" "size_t""'");
  } 
  arg2 = static_cast< size_t >(val2);
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)winnerTakesAll_3(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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN int Swig_var_pi_set(PyObject *) {
  SWIG_Error(SWIG_AttributeError,"Variable pi is read-only.");
  return 1;
}


SWIGINTERN PyObject *Swig_var_pi_get(void) {
  PyObject *pyobj = 0;
  
  pyobj = SWIG_From_double(static_cast< double >(nupic::pi));
  return pyobj;
}


SWIGINTERN PyObject *_wrap_fact(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  unsigned long arg1 ;
  unsigned long val1 ;
  int ecode1 = 0 ;
  PyObject * obj0 = 0 ;
  char *  kwnames[] = {
    (char *) "n", NULL 
  };
  double result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:fact",kwnames,&obj0)) SWIG_fail;
  ecode1 = SWIG_AsVal_unsigned_SS_long(obj0, &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "fact" "', argument " "1"" of type '" "unsigned long""'");
  } 
  arg1 = static_cast< unsigned long >(val1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (double)nupic::fact(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_double(static_cast< double >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_lfact(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  unsigned long arg1 ;
  unsigned long val1 ;
  int ecode1 = 0 ;
  PyObject * obj0 = 0 ;
  char *  kwnames[] = {
    (char *) "n", NULL 
  };
  double result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:lfact",kwnames,&obj0)) SWIG_fail;
  ecode1 = SWIG_AsVal_unsigned_SS_long(obj0, &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "lfact" "', argument " "1"" of type '" "unsigned long""'");
  } 
  arg1 = static_cast< unsigned long >(val1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (double)nupic::lfact(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_double(static_cast< double >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_binomial(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  unsigned long arg1 ;
  unsigned long arg2 ;
  unsigned long val1 ;
  int ecode1 = 0 ;
  unsigned long val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "n",(char *) "k", NULL 
  };
  double result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:binomial",kwnames,&obj0,&obj1)) SWIG_fail;
  ecode1 = SWIG_AsVal_unsigned_SS_long(obj0, &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "binomial" "', argument " "1"" of type '" "unsigned long""'");
  } 
  arg1 = static_cast< unsigned long >(val1);
  ecode2 = SWIG_AsVal_unsigned_SS_long(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "binomial" "', argument " "2"" of type '" "unsigned long""'");
  } 
  arg2 = static_cast< unsigned long >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (double)nupic::binomial(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_double(static_cast< double >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_LoggingException__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::string *arg1 = 0 ;
  nupic::UInt32 arg2 ;
  int res1 = SWIG_OLDOBJ ;
  nupic::LoggingException *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(swig_obj[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_LoggingException" "', argument " "1"" of type '" "std::string const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_LoggingException" "', argument " "1"" of type '" "std::string const &""'"); 
    }
    arg1 = ptr;
  }
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(swig_obj[1]);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::LoggingException *)new nupic::LoggingException((std::string 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_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__LoggingException, SWIG_POINTER_NEW |  0 );
  if (SWIG_IsNewObj(res1)) delete arg1;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_LoggingException(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::LoggingException *arg1 = (nupic::LoggingException *) 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__LoggingException, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_LoggingException" "', argument " "1"" of type '" "nupic::LoggingException *""'"); 
  }
  arg1 = reinterpret_cast< nupic::LoggingException * >(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_LoggingException_getMessage(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::LoggingException *arg1 = (nupic::LoggingException *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  char *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__LoggingException, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "LoggingException_getMessage" "', argument " "1"" of type '" "nupic::LoggingException const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::LoggingException * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (char *)((nupic::LoggingException const *)arg1)->getMessage();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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_LoggingException___lshift__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::LoggingException *arg1 = (nupic::LoggingException *) 0 ;
  std::vector< unsigned int,std::allocator< unsigned int > > arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "v", NULL 
  };
  nupic::LoggingException *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:LoggingException___lshift__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__LoggingException, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "LoggingException___lshift__" "', argument " "1"" of type '" "nupic::LoggingException *""'"); 
  }
  arg1 = reinterpret_cast< nupic::LoggingException * >(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 '" "LoggingException___lshift__" "', argument " "2"" of type '" "std::vector< unsigned int,std::allocator< unsigned int > >""'"); 
    }
    arg2 = *ptr;
    if (SWIG_IsNewObj(res)) delete ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::LoggingException *) &(arg1)->operator <<(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__LoggingException, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_LoggingException__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::LoggingException *arg1 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::LoggingException *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_nupic__LoggingException,  0  | 0);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_LoggingException" "', argument " "1"" of type '" "nupic::LoggingException const &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_LoggingException" "', argument " "1"" of type '" "nupic::LoggingException const &""'"); 
  }
  arg1 = reinterpret_cast< nupic::LoggingException * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::LoggingException *)new nupic::LoggingException((nupic::LoggingException 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__LoggingException, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_LoggingException(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_LoggingException",0,2,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;
      {
        int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_nupic__LoggingException, 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;
      {
        int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(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;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_new_LoggingException__SWIG_1(self, argc, argv);
    case 2:
      return _wrap_new_LoggingException__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_LoggingException'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::LoggingException::LoggingException(std::string const &,nupic::UInt32)\n"
    "    nupic::LoggingException::LoggingException(nupic::LoggingException const &)\n");
  return 0;
}


SWIGINTERN PyObject *LoggingException_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__LoggingException, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

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


SWIGINTERN PyObject *_wrap_new_Random__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::UInt64 arg1 = (nupic::UInt64) 0 ;
  unsigned long val1 ;
  int ecode1 = 0 ;
  nupic::Random *result = 0 ;
  
  if ((nobjs < 0) || (nobjs > 1)) SWIG_fail;
  if (swig_obj[0]) {
    ecode1 = SWIG_AsVal_unsigned_SS_long(swig_obj[0], &val1);
    if (!SWIG_IsOK(ecode1)) {
      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_Random" "', argument " "1"" of type '" "nupic::UInt64""'");
    } 
    arg1 = static_cast< nupic::UInt64 >(val1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Random *)new nupic::Random(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__Random, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_Random__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::Random *arg1 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::Random *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_nupic__Random,  0  | 0);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Random" "', argument " "1"" of type '" "nupic::Random const &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_Random" "', argument " "1"" of type '" "nupic::Random const &""'"); 
  }
  arg1 = reinterpret_cast< nupic::Random * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Random *)new nupic::Random((nupic::Random 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__Random, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_Random(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[2];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_Random",0,1,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if ((argc >= 0) && (argc <= 1)) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      if (argc > 0) {
        {
          {
            int res = SWIG_AsVal_unsigned_SS_long(argv[0], 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__Random, 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_Random__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_Random__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_Random'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::Random::Random(nupic::UInt64)\n"
    "    nupic::Random::Random(nupic::Random const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_delete_Random(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Random *arg1 = (nupic::Random *) 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__Random, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Random" "', argument " "1"" of type '" "nupic::Random *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Random * >(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_Random_write__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::Random *arg1 = (nupic::Random *) 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__Random, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Random_write" "', argument " "1"" of type '" "nupic::Random const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Random * >(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 '" "Random_write" "', argument " "2"" of type '" "std::ostream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Random_write" "', 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::Random 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_Random_write__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::Random *arg1 = (nupic::Random *) 0 ;
  RandomProto::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__Random, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Random_write" "', argument " "1"" of type '" "nupic::Random const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Random * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_RandomProto__Builder,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Random_write" "', argument " "2"" of type '" "RandomProto::Builder &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Random_write" "', argument " "2"" of type '" "RandomProto::Builder &""'"); 
  }
  arg2 = reinterpret_cast< RandomProto::Builder * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::Random 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_Random_read__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::Random *arg1 = (nupic::Random *) 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__Random, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Random_read" "', argument " "1"" of type '" "nupic::Random *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Random * >(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 '" "Random_read" "', argument " "2"" of type '" "std::istream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Random_read" "', 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)->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_Random_read__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::Random *arg1 = (nupic::Random *) 0 ;
  RandomProto::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__Random, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Random_read" "', argument " "1"" of type '" "nupic::Random *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Random * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_RandomProto__Reader,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Random_read" "', argument " "2"" of type '" "RandomProto::Reader &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Random_read" "', argument " "2"" of type '" "RandomProto::Reader &""'"); 
  }
  arg2 = reinterpret_cast< RandomProto::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_Random_getUInt32(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::Random *arg1 = (nupic::Random *) 0 ;
  nupic::UInt32 arg2 = (nupic::UInt32) nupic::Random::MAX32 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "max", NULL 
  };
  nupic::UInt32 result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:Random_getUInt32",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__Random, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Random_getUInt32" "', argument " "1"" of type '" "nupic::Random *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Random * >(argp1);
  if (obj1) {
    {
      arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt32)(arg1)->getUInt32(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_Random_getUInt64(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::Random *arg1 = (nupic::Random *) 0 ;
  nupic::UInt64 arg2 = (nupic::UInt64) nupic::Random::MAX64 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned long val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "max", NULL 
  };
  nupic::UInt64 result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:Random_getUInt64",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__Random, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Random_getUInt64" "', argument " "1"" of type '" "nupic::Random *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Random * >(argp1);
  if (obj1) {
    ecode2 = SWIG_AsVal_unsigned_SS_long(obj1, &val2);
    if (!SWIG_IsOK(ecode2)) {
      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Random_getUInt64" "', 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
    {
      result = (nupic::UInt64)(arg1)->getUInt64(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_long(static_cast< unsigned long >(result));
  return resultobj;
fail:
  return NULL;
}


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


SWIGINTERN PyObject *_wrap_Random___call__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::Random *arg1 = (nupic::Random *) 0 ;
  nupic::UInt32 arg2 = (nupic::UInt32) nupic::Random::MAX32 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "n", NULL 
  };
  nupic::UInt32 result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:Random___call__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__Random, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Random___call__" "', argument " "1"" of type '" "nupic::Random *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Random * >(argp1);
  if (obj1) {
    {
      arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt32)(arg1)->operator ()(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_Random_getSeed(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Random *arg1 = (nupic::Random *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt64 result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__Random, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Random_getSeed" "', argument " "1"" of type '" "nupic::Random *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Random * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt64)(arg1)->getSeed();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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_long(static_cast< unsigned long >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Random_max(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Random *arg1 = (nupic::Random *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::Random::result_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__Random, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Random_max" "', argument " "1"" of type '" "nupic::Random *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Random * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Random::result_type)(arg1)->max();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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_Random_min(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Random *arg1 = (nupic::Random *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::Random::result_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__Random, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Random_min" "', argument " "1"" of type '" "nupic::Random *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Random * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Random::result_type)(arg1)->min();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace 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 int Swig_var_Random_MAX32_set(PyObject *) {
  SWIG_Error(SWIG_AttributeError,"Variable Random_MAX32 is read-only.");
  return 1;
}


SWIGINTERN PyObject *Swig_var_Random_MAX32_get(void) {
  PyObject *pyobj = 0;
  
  pyobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(nupic::Random::MAX32));
  return pyobj;
}


SWIGINTERN int Swig_var_Random_MAX64_set(PyObject *) {
  SWIG_Error(SWIG_AttributeError,"Variable Random_MAX64 is read-only.");
  return 1;
}


SWIGINTERN PyObject *Swig_var_Random_MAX64_get(void) {
  PyObject *pyobj = 0;
  
  pyobj = SWIG_From_unsigned_SS_long(static_cast< unsigned long >(nupic::Random::MAX64));
  return pyobj;
}


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


SWIGINTERN PyObject *_wrap_Random___getstate__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Random *arg1 = (nupic::Random *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::string result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__Random, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Random___getstate__" "', argument " "1"" of type '" "nupic::Random *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Random * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = nupic_Random___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 = SWIG_From_std_string(static_cast< std::string >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Random_getState(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::Random *arg1 = (nupic::Random *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::string result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__Random, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Random_getState" "', argument " "1"" of type '" "nupic::Random *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Random * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = nupic_Random_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 = SWIG_From_std_string(static_cast< std::string >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Random_setState(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::Random *arg1 = (nupic::Random *) 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 *) "s", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Random_setState",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__Random, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Random_setState" "', argument " "1"" of type '" "nupic::Random *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Random * >(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 '" "Random_setState" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Random_setState" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_Random_setState(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_Random_setSeed(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::Random *arg1 = (nupic::Random *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Random_setSeed",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__Random, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Random_setSeed" "', argument " "1"" of type '" "nupic::Random *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Random * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_Random_setSeed(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_Random_jumpAhead(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::Random *arg1 = (nupic::Random *) 0 ;
  unsigned int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "n", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Random_jumpAhead",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__Random, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Random_jumpAhead" "', argument " "1"" of type '" "nupic::Random *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Random * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_Random_jumpAhead(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_Random_initializeUInt32Array(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::Random *arg1 = (nupic::Random *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  nupic::UInt32 arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_array",(char *) "max_value", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Random_initializeUInt32Array",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__Random, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Random_initializeUInt32Array" "', argument " "1"" of type '" "nupic::Random *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Random * >(argp1);
  arg2 = obj1;
  {
    arg3 = (nupic::UInt32) PyLong_AsLong(obj2);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_Random_initializeUInt32Array(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_Random_initializeReal32Array(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::Random *arg1 = (nupic::Random *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_array", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Random_initializeReal32Array",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__Random, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Random_initializeReal32Array" "', argument " "1"" of type '" "nupic::Random *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Random * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_Random_initializeReal32Array(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_Random_initializeReal32Array_01(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::Random *arg1 = (nupic::Random *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  nupic::Real32 arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "py_array",(char *) "proba", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Random_initializeReal32Array_01",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__Random, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Random_initializeReal32Array_01" "', argument " "1"" of type '" "nupic::Random *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Random * >(argp1);
  arg2 = obj1;
  {
    arg3 = (nupic::Real32) PyFloat_AsDouble(obj2);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_Random_initializeReal32Array_01(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_Random_sample(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::Random *arg1 = (nupic::Random *) 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 *) "population",(char *) "choices", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Random_sample",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__Random, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Random_sample" "', argument " "1"" of type '" "nupic::Random *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Random * >(argp1);
  arg2 = obj1;
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_Random_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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Random_shuffle(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::Random *arg1 = (nupic::Random *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "obj", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Random_shuffle",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__Random, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Random_shuffle" "', argument " "1"" of type '" "nupic::Random *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Random * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_Random_shuffle(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 = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Random_write__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::Random *arg1 = (nupic::Random *) 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__Random, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Random_write" "', argument " "1"" of type '" "nupic::Random const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Random * >(argp1);
  arg2 = swig_obj[1];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_Random_write__SWIG_2((nupic::Random 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_Random_write(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"Random_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__Random, 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__Random, 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_RandomProto__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__Random, 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_Random_write__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_Random_write__SWIG_1(self, argc, argv);
    case 3:
      return _wrap_Random_write__SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'Random_write'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::Random::write(std::ostream &) const\n"
    "    nupic::Random::write(RandomProto::Builder &) const\n"
    "    nupic::Random::write(PyObject *) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_Random_read__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::Random *arg1 = (nupic::Random *) 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__Random, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Random_read" "', argument " "1"" of type '" "nupic::Random *""'"); 
  }
  arg1 = reinterpret_cast< nupic::Random * >(argp1);
  arg2 = swig_obj[1];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_Random_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_Random_read(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"Random_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__Random, 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__Random, 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_RandomProto__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__Random, 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_Random_read__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_Random_read__SWIG_1(self, argc, argv);
    case 3:
      return _wrap_Random_read__SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'Random_read'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::Random::read(std::istream &)\n"
    "    nupic::Random::read(RandomProto::Reader &)\n"
    "    nupic::Random::read(PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *Random_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__Random, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap___lshift__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::ostream *arg1 = 0 ;
  nupic::Random *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *)"arg1",(char *)"arg2", NULL 
  };
  std::ostream *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:__lshift__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_std__ostream,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "__lshift__" "', argument " "1"" of type '" "std::ostream &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "__lshift__" "', argument " "1"" of type '" "std::ostream &""'"); 
  }
  arg1 = reinterpret_cast< std::ostream * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__Random,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "__lshift__" "', argument " "2"" of type '" "nupic::Random const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "__lshift__" "', argument " "2"" of type '" "nupic::Random const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::Random * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::ostream *) &nupic::operator <<(*arg1,(nupic::Random 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__ostream, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap___rshift__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::istream *arg1 = 0 ;
  nupic::Random *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *)"arg1",(char *)"arg2", NULL 
  };
  std::istream *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:__rshift__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_std__istream,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "__rshift__" "', argument " "1"" of type '" "std::istream &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "__rshift__" "', argument " "1"" of type '" "std::istream &""'"); 
  }
  arg1 = reinterpret_cast< std::istream * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__Random,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "__rshift__" "', argument " "2"" of type '" "nupic::Random &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "__rshift__" "', argument " "2"" of type '" "nupic::Random &""'"); 
  }
  arg2 = reinterpret_cast< nupic::Random * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::istream *) &nupic::operator >>(*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_std__istream, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


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


static PyMethodDef SwigMethods[] = {
	 { (char *)"SWIG_PyInstanceMethod_New", (PyCFunction)SWIG_PyInstanceMethod_New, METH_O, NULL},
	 { (char *)"delete_SwigPyIterator", (PyCFunction)_wrap_delete_SwigPyIterator, METH_O, (char *)"delete_SwigPyIterator(self)"},
	 { (char *)"SwigPyIterator_value", (PyCFunction)_wrap_SwigPyIterator_value, METH_O, (char *)"SwigPyIterator_value(self) -> PyObject *"},
	 { (char *)"SwigPyIterator_incr", (PyCFunction) _wrap_SwigPyIterator_incr, METH_VARARGS | METH_KEYWORDS, (char *)"SwigPyIterator_incr(self, n=1) -> SwigPyIterator"},
	 { (char *)"SwigPyIterator_decr", (PyCFunction) _wrap_SwigPyIterator_decr, METH_VARARGS | METH_KEYWORDS, (char *)"SwigPyIterator_decr(self, n=1) -> SwigPyIterator"},
	 { (char *)"SwigPyIterator_distance", (PyCFunction) _wrap_SwigPyIterator_distance, METH_VARARGS | METH_KEYWORDS, (char *)"SwigPyIterator_distance(self, x) -> ptrdiff_t"},
	 { (char *)"SwigPyIterator_equal", (PyCFunction) _wrap_SwigPyIterator_equal, METH_VARARGS | METH_KEYWORDS, (char *)"SwigPyIterator_equal(self, x) -> bool"},
	 { (char *)"SwigPyIterator_copy", (PyCFunction)_wrap_SwigPyIterator_copy, METH_O, (char *)"SwigPyIterator_copy(self) -> SwigPyIterator"},
	 { (char *)"SwigPyIterator_next", (PyCFunction)_wrap_SwigPyIterator_next, METH_O, (char *)"SwigPyIterator_next(self) -> PyObject *"},
	 { (char *)"SwigPyIterator___next__", (PyCFunction)_wrap_SwigPyIterator___next__, METH_O, (char *)"SwigPyIterator___next__(self) -> PyObject *"},
	 { (char *)"SwigPyIterator_previous", (PyCFunction)_wrap_SwigPyIterator_previous, METH_O, (char *)"SwigPyIterator_previous(self) -> PyObject *"},
	 { (char *)"SwigPyIterator_advance", (PyCFunction) _wrap_SwigPyIterator_advance, METH_VARARGS | METH_KEYWORDS, (char *)"SwigPyIterator_advance(self, n) -> SwigPyIterator"},
	 { (char *)"SwigPyIterator___eq__", (PyCFunction) _wrap_SwigPyIterator___eq__, METH_VARARGS | METH_KEYWORDS, (char *)"SwigPyIterator___eq__(self, x) -> bool"},
	 { (char *)"SwigPyIterator___ne__", (PyCFunction) _wrap_SwigPyIterator___ne__, METH_VARARGS | METH_KEYWORDS, (char *)"SwigPyIterator___ne__(self, x) -> bool"},
	 { (char *)"SwigPyIterator___iadd__", (PyCFunction) _wrap_SwigPyIterator___iadd__, METH_VARARGS | METH_KEYWORDS, (char *)"SwigPyIterator___iadd__(self, n) -> SwigPyIterator"},
	 { (char *)"SwigPyIterator___isub__", (PyCFunction) _wrap_SwigPyIterator___isub__, METH_VARARGS | METH_KEYWORDS, (char *)"SwigPyIterator___isub__(self, n) -> SwigPyIterator"},
	 { (char *)"SwigPyIterator___add__", (PyCFunction) _wrap_SwigPyIterator___add__, METH_VARARGS | METH_KEYWORDS, (char *)"SwigPyIterator___add__(self, n) -> SwigPyIterator"},
	 { (char *)"SwigPyIterator___sub__", _wrap_SwigPyIterator___sub__, METH_VARARGS, (char *)"\n"
		"__sub__(n) -> SwigPyIterator\n"
		"SwigPyIterator___sub__(self, x) -> ptrdiff_t\n"
		""},
	 { (char *)"SwigPyIterator_swigregister", SwigPyIterator_swigregister, METH_VARARGS, NULL},
	 { (char *)"VectorOfInt32_iterator", (PyCFunction)_wrap_VectorOfInt32_iterator, METH_O, (char *)"VectorOfInt32_iterator(self) -> SwigPyIterator"},
	 { (char *)"VectorOfInt32___nonzero__", (PyCFunction)_wrap_VectorOfInt32___nonzero__, METH_O, (char *)"VectorOfInt32___nonzero__(self) -> bool"},
	 { (char *)"VectorOfInt32___bool__", (PyCFunction)_wrap_VectorOfInt32___bool__, METH_O, (char *)"VectorOfInt32___bool__(self) -> bool"},
	 { (char *)"VectorOfInt32___len__", (PyCFunction)_wrap_VectorOfInt32___len__, METH_O, (char *)"VectorOfInt32___len__(self) -> std::vector< int >::size_type"},
	 { (char *)"VectorOfInt32_pop", (PyCFunction)_wrap_VectorOfInt32_pop, METH_O, (char *)"VectorOfInt32_pop(self) -> std::vector< int >::value_type"},
	 { (char *)"VectorOfInt32___getslice__", (PyCFunction) _wrap_VectorOfInt32___getslice__, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfInt32___getslice__(self, i, j) -> VectorOfInt32"},
	 { (char *)"VectorOfInt32___setslice__", (PyCFunction) _wrap_VectorOfInt32___setslice__, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfInt32___setslice__(self, i, j, v=std::vector< int,std::allocator< int > >())"},
	 { (char *)"VectorOfInt32___delslice__", (PyCFunction) _wrap_VectorOfInt32___delslice__, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfInt32___delslice__(self, i, j)"},
	 { (char *)"VectorOfInt32___delitem__", _wrap_VectorOfInt32___delitem__, METH_VARARGS, (char *)"\n"
		"__delitem__(i)\n"
		"VectorOfInt32___delitem__(self, slice)\n"
		""},
	 { (char *)"VectorOfInt32___getitem__", _wrap_VectorOfInt32___getitem__, METH_VARARGS, (char *)"\n"
		"__getitem__(slice) -> VectorOfInt32\n"
		"VectorOfInt32___getitem__(self, i) -> std::vector< int >::value_type const &\n"
		""},
	 { (char *)"VectorOfInt32___setitem__", _wrap_VectorOfInt32___setitem__, METH_VARARGS, (char *)"\n"
		"__setitem__(slice, v)\n"
		"__setitem__(slice)\n"
		"VectorOfInt32___setitem__(self, i, x)\n"
		""},
	 { (char *)"VectorOfInt32_append", (PyCFunction) _wrap_VectorOfInt32_append, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfInt32_append(self, x)"},
	 { (char *)"VectorOfInt32_empty", (PyCFunction)_wrap_VectorOfInt32_empty, METH_O, (char *)"VectorOfInt32_empty(self) -> bool"},
	 { (char *)"VectorOfInt32_size", (PyCFunction)_wrap_VectorOfInt32_size, METH_O, (char *)"VectorOfInt32_size(self) -> std::vector< int >::size_type"},
	 { (char *)"VectorOfInt32_clear", (PyCFunction)_wrap_VectorOfInt32_clear, METH_O, (char *)"VectorOfInt32_clear(self)"},
	 { (char *)"VectorOfInt32_swap", (PyCFunction) _wrap_VectorOfInt32_swap, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfInt32_swap(self, v)"},
	 { (char *)"VectorOfInt32_get_allocator", (PyCFunction)_wrap_VectorOfInt32_get_allocator, METH_O, (char *)"VectorOfInt32_get_allocator(self) -> std::vector< int >::allocator_type"},
	 { (char *)"VectorOfInt32_begin", (PyCFunction)_wrap_VectorOfInt32_begin, METH_O, (char *)"VectorOfInt32_begin(self) -> std::vector< int >::iterator"},
	 { (char *)"VectorOfInt32_end", (PyCFunction)_wrap_VectorOfInt32_end, METH_O, (char *)"VectorOfInt32_end(self) -> std::vector< int >::iterator"},
	 { (char *)"VectorOfInt32_rbegin", (PyCFunction)_wrap_VectorOfInt32_rbegin, METH_O, (char *)"VectorOfInt32_rbegin(self) -> std::vector< int >::reverse_iterator"},
	 { (char *)"VectorOfInt32_rend", (PyCFunction)_wrap_VectorOfInt32_rend, METH_O, (char *)"VectorOfInt32_rend(self) -> std::vector< int >::reverse_iterator"},
	 { (char *)"VectorOfInt32_pop_back", (PyCFunction)_wrap_VectorOfInt32_pop_back, METH_O, (char *)"VectorOfInt32_pop_back(self)"},
	 { (char *)"VectorOfInt32_erase", _wrap_VectorOfInt32_erase, METH_VARARGS, (char *)"\n"
		"erase(pos) -> std::vector< int >::iterator\n"
		"VectorOfInt32_erase(self, first, last) -> std::vector< int >::iterator\n"
		""},
	 { (char *)"new_VectorOfInt32", _wrap_new_VectorOfInt32, METH_VARARGS, (char *)"\n"
		"VectorOfInt32()\n"
		"VectorOfInt32(arg2)\n"
		"VectorOfInt32(size)\n"
		"new_VectorOfInt32(size, value) -> VectorOfInt32\n"
		""},
	 { (char *)"VectorOfInt32_push_back", (PyCFunction) _wrap_VectorOfInt32_push_back, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfInt32_push_back(self, x)"},
	 { (char *)"VectorOfInt32_front", (PyCFunction)_wrap_VectorOfInt32_front, METH_O, (char *)"VectorOfInt32_front(self) -> std::vector< int >::value_type const &"},
	 { (char *)"VectorOfInt32_back", (PyCFunction)_wrap_VectorOfInt32_back, METH_O, (char *)"VectorOfInt32_back(self) -> std::vector< int >::value_type const &"},
	 { (char *)"VectorOfInt32_assign", (PyCFunction) _wrap_VectorOfInt32_assign, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfInt32_assign(self, n, x)"},
	 { (char *)"VectorOfInt32_resize", _wrap_VectorOfInt32_resize, METH_VARARGS, (char *)"\n"
		"resize(new_size)\n"
		"VectorOfInt32_resize(self, new_size, x)\n"
		""},
	 { (char *)"VectorOfInt32_insert", _wrap_VectorOfInt32_insert, METH_VARARGS, (char *)"\n"
		"insert(pos, x) -> std::vector< int >::iterator\n"
		"VectorOfInt32_insert(self, pos, n, x)\n"
		""},
	 { (char *)"VectorOfInt32_reserve", (PyCFunction) _wrap_VectorOfInt32_reserve, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfInt32_reserve(self, n)"},
	 { (char *)"VectorOfInt32_capacity", (PyCFunction)_wrap_VectorOfInt32_capacity, METH_O, (char *)"VectorOfInt32_capacity(self) -> std::vector< int >::size_type"},
	 { (char *)"delete_VectorOfInt32", (PyCFunction)_wrap_delete_VectorOfInt32, METH_O, (char *)"delete_VectorOfInt32(self)"},
	 { (char *)"VectorOfInt32_swigregister", VectorOfInt32_swigregister, METH_VARARGS, NULL},
	 { (char *)"VectorOfInt64_iterator", (PyCFunction)_wrap_VectorOfInt64_iterator, METH_O, (char *)"VectorOfInt64_iterator(self) -> SwigPyIterator"},
	 { (char *)"VectorOfInt64___nonzero__", (PyCFunction)_wrap_VectorOfInt64___nonzero__, METH_O, (char *)"VectorOfInt64___nonzero__(self) -> bool"},
	 { (char *)"VectorOfInt64___bool__", (PyCFunction)_wrap_VectorOfInt64___bool__, METH_O, (char *)"VectorOfInt64___bool__(self) -> bool"},
	 { (char *)"VectorOfInt64___len__", (PyCFunction)_wrap_VectorOfInt64___len__, METH_O, (char *)"VectorOfInt64___len__(self) -> std::vector< long >::size_type"},
	 { (char *)"VectorOfInt64_pop", (PyCFunction)_wrap_VectorOfInt64_pop, METH_O, (char *)"VectorOfInt64_pop(self) -> std::vector< long >::value_type"},
	 { (char *)"VectorOfInt64___getslice__", (PyCFunction) _wrap_VectorOfInt64___getslice__, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfInt64___getslice__(self, i, j) -> VectorOfInt64"},
	 { (char *)"VectorOfInt64___setslice__", (PyCFunction) _wrap_VectorOfInt64___setslice__, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfInt64___setslice__(self, i, j, v=std::vector< long,std::allocator< long > >())"},
	 { (char *)"VectorOfInt64___delslice__", (PyCFunction) _wrap_VectorOfInt64___delslice__, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfInt64___delslice__(self, i, j)"},
	 { (char *)"VectorOfInt64___delitem__", _wrap_VectorOfInt64___delitem__, METH_VARARGS, (char *)"\n"
		"__delitem__(i)\n"
		"VectorOfInt64___delitem__(self, slice)\n"
		""},
	 { (char *)"VectorOfInt64___getitem__", _wrap_VectorOfInt64___getitem__, METH_VARARGS, (char *)"\n"
		"__getitem__(slice) -> VectorOfInt64\n"
		"VectorOfInt64___getitem__(self, i) -> std::vector< long >::value_type const &\n"
		""},
	 { (char *)"VectorOfInt64___setitem__", _wrap_VectorOfInt64___setitem__, METH_VARARGS, (char *)"\n"
		"__setitem__(slice, v)\n"
		"__setitem__(slice)\n"
		"VectorOfInt64___setitem__(self, i, x)\n"
		""},
	 { (char *)"VectorOfInt64_append", (PyCFunction) _wrap_VectorOfInt64_append, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfInt64_append(self, x)"},
	 { (char *)"VectorOfInt64_empty", (PyCFunction)_wrap_VectorOfInt64_empty, METH_O, (char *)"VectorOfInt64_empty(self) -> bool"},
	 { (char *)"VectorOfInt64_size", (PyCFunction)_wrap_VectorOfInt64_size, METH_O, (char *)"VectorOfInt64_size(self) -> std::vector< long >::size_type"},
	 { (char *)"VectorOfInt64_clear", (PyCFunction)_wrap_VectorOfInt64_clear, METH_O, (char *)"VectorOfInt64_clear(self)"},
	 { (char *)"VectorOfInt64_swap", (PyCFunction) _wrap_VectorOfInt64_swap, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfInt64_swap(self, v)"},
	 { (char *)"VectorOfInt64_get_allocator", (PyCFunction)_wrap_VectorOfInt64_get_allocator, METH_O, (char *)"VectorOfInt64_get_allocator(self) -> std::vector< long >::allocator_type"},
	 { (char *)"VectorOfInt64_begin", (PyCFunction)_wrap_VectorOfInt64_begin, METH_O, (char *)"VectorOfInt64_begin(self) -> std::vector< long >::iterator"},
	 { (char *)"VectorOfInt64_end", (PyCFunction)_wrap_VectorOfInt64_end, METH_O, (char *)"VectorOfInt64_end(self) -> std::vector< long >::iterator"},
	 { (char *)"VectorOfInt64_rbegin", (PyCFunction)_wrap_VectorOfInt64_rbegin, METH_O, (char *)"VectorOfInt64_rbegin(self) -> std::vector< long >::reverse_iterator"},
	 { (char *)"VectorOfInt64_rend", (PyCFunction)_wrap_VectorOfInt64_rend, METH_O, (char *)"VectorOfInt64_rend(self) -> std::vector< long >::reverse_iterator"},
	 { (char *)"VectorOfInt64_pop_back", (PyCFunction)_wrap_VectorOfInt64_pop_back, METH_O, (char *)"VectorOfInt64_pop_back(self)"},
	 { (char *)"VectorOfInt64_erase", _wrap_VectorOfInt64_erase, METH_VARARGS, (char *)"\n"
		"erase(pos) -> std::vector< long >::iterator\n"
		"VectorOfInt64_erase(self, first, last) -> std::vector< long >::iterator\n"
		""},
	 { (char *)"new_VectorOfInt64", _wrap_new_VectorOfInt64, METH_VARARGS, (char *)"\n"
		"VectorOfInt64()\n"
		"VectorOfInt64(arg2)\n"
		"VectorOfInt64(size)\n"
		"new_VectorOfInt64(size, value) -> VectorOfInt64\n"
		""},
	 { (char *)"VectorOfInt64_push_back", (PyCFunction) _wrap_VectorOfInt64_push_back, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfInt64_push_back(self, x)"},
	 { (char *)"VectorOfInt64_front", (PyCFunction)_wrap_VectorOfInt64_front, METH_O, (char *)"VectorOfInt64_front(self) -> std::vector< long >::value_type const &"},
	 { (char *)"VectorOfInt64_back", (PyCFunction)_wrap_VectorOfInt64_back, METH_O, (char *)"VectorOfInt64_back(self) -> std::vector< long >::value_type const &"},
	 { (char *)"VectorOfInt64_assign", (PyCFunction) _wrap_VectorOfInt64_assign, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfInt64_assign(self, n, x)"},
	 { (char *)"VectorOfInt64_resize", _wrap_VectorOfInt64_resize, METH_VARARGS, (char *)"\n"
		"resize(new_size)\n"
		"VectorOfInt64_resize(self, new_size, x)\n"
		""},
	 { (char *)"VectorOfInt64_insert", _wrap_VectorOfInt64_insert, METH_VARARGS, (char *)"\n"
		"insert(pos, x) -> std::vector< long >::iterator\n"
		"VectorOfInt64_insert(self, pos, n, x)\n"
		""},
	 { (char *)"VectorOfInt64_reserve", (PyCFunction) _wrap_VectorOfInt64_reserve, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfInt64_reserve(self, n)"},
	 { (char *)"VectorOfInt64_capacity", (PyCFunction)_wrap_VectorOfInt64_capacity, METH_O, (char *)"VectorOfInt64_capacity(self) -> std::vector< long >::size_type"},
	 { (char *)"delete_VectorOfInt64", (PyCFunction)_wrap_delete_VectorOfInt64, METH_O, (char *)"delete_VectorOfInt64(self)"},
	 { (char *)"VectorOfInt64_swigregister", VectorOfInt64_swigregister, METH_VARARGS, NULL},
	 { (char *)"VectorOfUInt32_iterator", (PyCFunction)_wrap_VectorOfUInt32_iterator, METH_O, (char *)"VectorOfUInt32_iterator(self) -> SwigPyIterator"},
	 { (char *)"VectorOfUInt32___nonzero__", (PyCFunction)_wrap_VectorOfUInt32___nonzero__, METH_O, (char *)"VectorOfUInt32___nonzero__(self) -> bool"},
	 { (char *)"VectorOfUInt32___bool__", (PyCFunction)_wrap_VectorOfUInt32___bool__, METH_O, (char *)"VectorOfUInt32___bool__(self) -> bool"},
	 { (char *)"VectorOfUInt32___len__", (PyCFunction)_wrap_VectorOfUInt32___len__, METH_O, (char *)"VectorOfUInt32___len__(self) -> std::vector< unsigned int >::size_type"},
	 { (char *)"VectorOfUInt32_pop", (PyCFunction)_wrap_VectorOfUInt32_pop, METH_O, (char *)"VectorOfUInt32_pop(self) -> std::vector< unsigned int >::value_type"},
	 { (char *)"VectorOfUInt32___getslice__", (PyCFunction) _wrap_VectorOfUInt32___getslice__, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfUInt32___getslice__(self, i, j) -> VectorOfUInt32"},
	 { (char *)"VectorOfUInt32___setslice__", (PyCFunction) _wrap_VectorOfUInt32___setslice__, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfUInt32___setslice__(self, i, j, v=std::vector< unsigned int,std::allocator< unsigned int > >())"},
	 { (char *)"VectorOfUInt32___delslice__", (PyCFunction) _wrap_VectorOfUInt32___delslice__, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfUInt32___delslice__(self, i, j)"},
	 { (char *)"VectorOfUInt32___delitem__", _wrap_VectorOfUInt32___delitem__, METH_VARARGS, (char *)"\n"
		"__delitem__(i)\n"
		"VectorOfUInt32___delitem__(self, slice)\n"
		""},
	 { (char *)"VectorOfUInt32___getitem__", _wrap_VectorOfUInt32___getitem__, METH_VARARGS, (char *)"\n"
		"__getitem__(slice) -> VectorOfUInt32\n"
		"VectorOfUInt32___getitem__(self, i) -> std::vector< unsigned int >::value_type const &\n"
		""},
	 { (char *)"VectorOfUInt32___setitem__", _wrap_VectorOfUInt32___setitem__, METH_VARARGS, (char *)"\n"
		"__setitem__(slice, v)\n"
		"__setitem__(slice)\n"
		"VectorOfUInt32___setitem__(self, i, x)\n"
		""},
	 { (char *)"VectorOfUInt32_append", (PyCFunction) _wrap_VectorOfUInt32_append, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfUInt32_append(self, x)"},
	 { (char *)"VectorOfUInt32_empty", (PyCFunction)_wrap_VectorOfUInt32_empty, METH_O, (char *)"VectorOfUInt32_empty(self) -> bool"},
	 { (char *)"VectorOfUInt32_size", (PyCFunction)_wrap_VectorOfUInt32_size, METH_O, (char *)"VectorOfUInt32_size(self) -> std::vector< unsigned int >::size_type"},
	 { (char *)"VectorOfUInt32_clear", (PyCFunction)_wrap_VectorOfUInt32_clear, METH_O, (char *)"VectorOfUInt32_clear(self)"},
	 { (char *)"VectorOfUInt32_swap", (PyCFunction) _wrap_VectorOfUInt32_swap, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfUInt32_swap(self, v)"},
	 { (char *)"VectorOfUInt32_get_allocator", (PyCFunction)_wrap_VectorOfUInt32_get_allocator, METH_O, (char *)"VectorOfUInt32_get_allocator(self) -> std::vector< unsigned int >::allocator_type"},
	 { (char *)"VectorOfUInt32_begin", (PyCFunction)_wrap_VectorOfUInt32_begin, METH_O, (char *)"VectorOfUInt32_begin(self) -> std::vector< unsigned int >::iterator"},
	 { (char *)"VectorOfUInt32_end", (PyCFunction)_wrap_VectorOfUInt32_end, METH_O, (char *)"VectorOfUInt32_end(self) -> std::vector< unsigned int >::iterator"},
	 { (char *)"VectorOfUInt32_rbegin", (PyCFunction)_wrap_VectorOfUInt32_rbegin, METH_O, (char *)"VectorOfUInt32_rbegin(self) -> std::vector< unsigned int >::reverse_iterator"},
	 { (char *)"VectorOfUInt32_rend", (PyCFunction)_wrap_VectorOfUInt32_rend, METH_O, (char *)"VectorOfUInt32_rend(self) -> std::vector< unsigned int >::reverse_iterator"},
	 { (char *)"VectorOfUInt32_pop_back", (PyCFunction)_wrap_VectorOfUInt32_pop_back, METH_O, (char *)"VectorOfUInt32_pop_back(self)"},
	 { (char *)"VectorOfUInt32_erase", _wrap_VectorOfUInt32_erase, METH_VARARGS, (char *)"\n"
		"erase(pos) -> std::vector< unsigned int >::iterator\n"
		"VectorOfUInt32_erase(self, first, last) -> std::vector< unsigned int >::iterator\n"
		""},
	 { (char *)"new_VectorOfUInt32", _wrap_new_VectorOfUInt32, METH_VARARGS, (char *)"\n"
		"VectorOfUInt32()\n"
		"VectorOfUInt32(arg2)\n"
		"VectorOfUInt32(size)\n"
		"new_VectorOfUInt32(size, value) -> VectorOfUInt32\n"
		""},
	 { (char *)"VectorOfUInt32_push_back", (PyCFunction) _wrap_VectorOfUInt32_push_back, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfUInt32_push_back(self, x)"},
	 { (char *)"VectorOfUInt32_front", (PyCFunction)_wrap_VectorOfUInt32_front, METH_O, (char *)"VectorOfUInt32_front(self) -> std::vector< unsigned int >::value_type const &"},
	 { (char *)"VectorOfUInt32_back", (PyCFunction)_wrap_VectorOfUInt32_back, METH_O, (char *)"VectorOfUInt32_back(self) -> std::vector< unsigned int >::value_type const &"},
	 { (char *)"VectorOfUInt32_assign", (PyCFunction) _wrap_VectorOfUInt32_assign, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfUInt32_assign(self, n, x)"},
	 { (char *)"VectorOfUInt32_resize", _wrap_VectorOfUInt32_resize, METH_VARARGS, (char *)"\n"
		"resize(new_size)\n"
		"VectorOfUInt32_resize(self, new_size, x)\n"
		""},
	 { (char *)"VectorOfUInt32_insert", _wrap_VectorOfUInt32_insert, METH_VARARGS, (char *)"\n"
		"insert(pos, x) -> std::vector< unsigned int >::iterator\n"
		"VectorOfUInt32_insert(self, pos, n, x)\n"
		""},
	 { (char *)"VectorOfUInt32_reserve", (PyCFunction) _wrap_VectorOfUInt32_reserve, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfUInt32_reserve(self, n)"},
	 { (char *)"VectorOfUInt32_capacity", (PyCFunction)_wrap_VectorOfUInt32_capacity, METH_O, (char *)"VectorOfUInt32_capacity(self) -> std::vector< unsigned int >::size_type"},
	 { (char *)"delete_VectorOfUInt32", (PyCFunction)_wrap_delete_VectorOfUInt32, METH_O, (char *)"delete_VectorOfUInt32(self)"},
	 { (char *)"VectorOfUInt32_swigregister", VectorOfUInt32_swigregister, METH_VARARGS, NULL},
	 { (char *)"VectorOfUInt64_iterator", (PyCFunction)_wrap_VectorOfUInt64_iterator, METH_O, (char *)"VectorOfUInt64_iterator(self) -> SwigPyIterator"},
	 { (char *)"VectorOfUInt64___nonzero__", (PyCFunction)_wrap_VectorOfUInt64___nonzero__, METH_O, (char *)"VectorOfUInt64___nonzero__(self) -> bool"},
	 { (char *)"VectorOfUInt64___bool__", (PyCFunction)_wrap_VectorOfUInt64___bool__, METH_O, (char *)"VectorOfUInt64___bool__(self) -> bool"},
	 { (char *)"VectorOfUInt64___len__", (PyCFunction)_wrap_VectorOfUInt64___len__, METH_O, (char *)"VectorOfUInt64___len__(self) -> std::vector< unsigned long >::size_type"},
	 { (char *)"VectorOfUInt64_pop", (PyCFunction)_wrap_VectorOfUInt64_pop, METH_O, (char *)"VectorOfUInt64_pop(self) -> std::vector< unsigned long >::value_type"},
	 { (char *)"VectorOfUInt64___getslice__", (PyCFunction) _wrap_VectorOfUInt64___getslice__, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfUInt64___getslice__(self, i, j) -> VectorOfUInt64"},
	 { (char *)"VectorOfUInt64___setslice__", (PyCFunction) _wrap_VectorOfUInt64___setslice__, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfUInt64___setslice__(self, i, j, v=std::vector< unsigned long,std::allocator< unsigned long > >())"},
	 { (char *)"VectorOfUInt64___delslice__", (PyCFunction) _wrap_VectorOfUInt64___delslice__, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfUInt64___delslice__(self, i, j)"},
	 { (char *)"VectorOfUInt64___delitem__", _wrap_VectorOfUInt64___delitem__, METH_VARARGS, (char *)"\n"
		"__delitem__(i)\n"
		"VectorOfUInt64___delitem__(self, slice)\n"
		""},
	 { (char *)"VectorOfUInt64___getitem__", _wrap_VectorOfUInt64___getitem__, METH_VARARGS, (char *)"\n"
		"__getitem__(slice) -> VectorOfUInt64\n"
		"VectorOfUInt64___getitem__(self, i) -> std::vector< unsigned long >::value_type const &\n"
		""},
	 { (char *)"VectorOfUInt64___setitem__", _wrap_VectorOfUInt64___setitem__, METH_VARARGS, (char *)"\n"
		"__setitem__(slice, v)\n"
		"__setitem__(slice)\n"
		"VectorOfUInt64___setitem__(self, i, x)\n"
		""},
	 { (char *)"VectorOfUInt64_append", (PyCFunction) _wrap_VectorOfUInt64_append, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfUInt64_append(self, x)"},
	 { (char *)"VectorOfUInt64_empty", (PyCFunction)_wrap_VectorOfUInt64_empty, METH_O, (char *)"VectorOfUInt64_empty(self) -> bool"},
	 { (char *)"VectorOfUInt64_size", (PyCFunction)_wrap_VectorOfUInt64_size, METH_O, (char *)"VectorOfUInt64_size(self) -> std::vector< unsigned long >::size_type"},
	 { (char *)"VectorOfUInt64_clear", (PyCFunction)_wrap_VectorOfUInt64_clear, METH_O, (char *)"VectorOfUInt64_clear(self)"},
	 { (char *)"VectorOfUInt64_swap", (PyCFunction) _wrap_VectorOfUInt64_swap, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfUInt64_swap(self, v)"},
	 { (char *)"VectorOfUInt64_get_allocator", (PyCFunction)_wrap_VectorOfUInt64_get_allocator, METH_O, (char *)"VectorOfUInt64_get_allocator(self) -> std::vector< unsigned long >::allocator_type"},
	 { (char *)"VectorOfUInt64_begin", (PyCFunction)_wrap_VectorOfUInt64_begin, METH_O, (char *)"VectorOfUInt64_begin(self) -> std::vector< unsigned long >::iterator"},
	 { (char *)"VectorOfUInt64_end", (PyCFunction)_wrap_VectorOfUInt64_end, METH_O, (char *)"VectorOfUInt64_end(self) -> std::vector< unsigned long >::iterator"},
	 { (char *)"VectorOfUInt64_rbegin", (PyCFunction)_wrap_VectorOfUInt64_rbegin, METH_O, (char *)"VectorOfUInt64_rbegin(self) -> std::vector< unsigned long >::reverse_iterator"},
	 { (char *)"VectorOfUInt64_rend", (PyCFunction)_wrap_VectorOfUInt64_rend, METH_O, (char *)"VectorOfUInt64_rend(self) -> std::vector< unsigned long >::reverse_iterator"},
	 { (char *)"VectorOfUInt64_pop_back", (PyCFunction)_wrap_VectorOfUInt64_pop_back, METH_O, (char *)"VectorOfUInt64_pop_back(self)"},
	 { (char *)"VectorOfUInt64_erase", _wrap_VectorOfUInt64_erase, METH_VARARGS, (char *)"\n"
		"erase(pos) -> std::vector< unsigned long >::iterator\n"
		"VectorOfUInt64_erase(self, first, last) -> std::vector< unsigned long >::iterator\n"
		""},
	 { (char *)"new_VectorOfUInt64", _wrap_new_VectorOfUInt64, METH_VARARGS, (char *)"\n"
		"VectorOfUInt64()\n"
		"VectorOfUInt64(arg2)\n"
		"VectorOfUInt64(size)\n"
		"new_VectorOfUInt64(size, value) -> VectorOfUInt64\n"
		""},
	 { (char *)"VectorOfUInt64_push_back", (PyCFunction) _wrap_VectorOfUInt64_push_back, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfUInt64_push_back(self, x)"},
	 { (char *)"VectorOfUInt64_front", (PyCFunction)_wrap_VectorOfUInt64_front, METH_O, (char *)"VectorOfUInt64_front(self) -> std::vector< unsigned long >::value_type const &"},
	 { (char *)"VectorOfUInt64_back", (PyCFunction)_wrap_VectorOfUInt64_back, METH_O, (char *)"VectorOfUInt64_back(self) -> std::vector< unsigned long >::value_type const &"},
	 { (char *)"VectorOfUInt64_assign", (PyCFunction) _wrap_VectorOfUInt64_assign, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfUInt64_assign(self, n, x)"},
	 { (char *)"VectorOfUInt64_resize", _wrap_VectorOfUInt64_resize, METH_VARARGS, (char *)"\n"
		"resize(new_size)\n"
		"VectorOfUInt64_resize(self, new_size, x)\n"
		""},
	 { (char *)"VectorOfUInt64_insert", _wrap_VectorOfUInt64_insert, METH_VARARGS, (char *)"\n"
		"insert(pos, x) -> std::vector< unsigned long >::iterator\n"
		"VectorOfUInt64_insert(self, pos, n, x)\n"
		""},
	 { (char *)"VectorOfUInt64_reserve", (PyCFunction) _wrap_VectorOfUInt64_reserve, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfUInt64_reserve(self, n)"},
	 { (char *)"VectorOfUInt64_capacity", (PyCFunction)_wrap_VectorOfUInt64_capacity, METH_O, (char *)"VectorOfUInt64_capacity(self) -> std::vector< unsigned long >::size_type"},
	 { (char *)"delete_VectorOfUInt64", (PyCFunction)_wrap_delete_VectorOfUInt64, METH_O, (char *)"delete_VectorOfUInt64(self)"},
	 { (char *)"VectorOfUInt64_swigregister", VectorOfUInt64_swigregister, METH_VARARGS, NULL},
	 { (char *)"FloatVector_iterator", (PyCFunction)_wrap_FloatVector_iterator, METH_O, (char *)"FloatVector_iterator(self) -> SwigPyIterator"},
	 { (char *)"FloatVector___nonzero__", (PyCFunction)_wrap_FloatVector___nonzero__, METH_O, (char *)"FloatVector___nonzero__(self) -> bool"},
	 { (char *)"FloatVector___bool__", (PyCFunction)_wrap_FloatVector___bool__, METH_O, (char *)"FloatVector___bool__(self) -> bool"},
	 { (char *)"FloatVector___len__", (PyCFunction)_wrap_FloatVector___len__, METH_O, (char *)"FloatVector___len__(self) -> std::vector< float >::size_type"},
	 { (char *)"FloatVector_pop", (PyCFunction)_wrap_FloatVector_pop, METH_O, (char *)"FloatVector_pop(self) -> std::vector< float >::value_type"},
	 { (char *)"FloatVector___getslice__", (PyCFunction) _wrap_FloatVector___getslice__, METH_VARARGS | METH_KEYWORDS, (char *)"FloatVector___getslice__(self, i, j) -> FloatVector"},
	 { (char *)"FloatVector___setslice__", (PyCFunction) _wrap_FloatVector___setslice__, METH_VARARGS | METH_KEYWORDS, (char *)"FloatVector___setslice__(self, i, j, v=std::vector< float,std::allocator< float > >())"},
	 { (char *)"FloatVector___delslice__", (PyCFunction) _wrap_FloatVector___delslice__, METH_VARARGS | METH_KEYWORDS, (char *)"FloatVector___delslice__(self, i, j)"},
	 { (char *)"FloatVector___delitem__", _wrap_FloatVector___delitem__, METH_VARARGS, (char *)"\n"
		"__delitem__(i)\n"
		"FloatVector___delitem__(self, slice)\n"
		""},
	 { (char *)"FloatVector___getitem__", _wrap_FloatVector___getitem__, METH_VARARGS, (char *)"\n"
		"__getitem__(slice) -> FloatVector\n"
		"FloatVector___getitem__(self, i) -> std::vector< float >::value_type const &\n"
		""},
	 { (char *)"FloatVector___setitem__", _wrap_FloatVector___setitem__, METH_VARARGS, (char *)"\n"
		"__setitem__(slice, v)\n"
		"__setitem__(slice)\n"
		"FloatVector___setitem__(self, i, x)\n"
		""},
	 { (char *)"FloatVector_append", (PyCFunction) _wrap_FloatVector_append, METH_VARARGS | METH_KEYWORDS, (char *)"FloatVector_append(self, x)"},
	 { (char *)"FloatVector_empty", (PyCFunction)_wrap_FloatVector_empty, METH_O, (char *)"FloatVector_empty(self) -> bool"},
	 { (char *)"FloatVector_size", (PyCFunction)_wrap_FloatVector_size, METH_O, (char *)"FloatVector_size(self) -> std::vector< float >::size_type"},
	 { (char *)"FloatVector_clear", (PyCFunction)_wrap_FloatVector_clear, METH_O, (char *)"FloatVector_clear(self)"},
	 { (char *)"FloatVector_swap", (PyCFunction) _wrap_FloatVector_swap, METH_VARARGS | METH_KEYWORDS, (char *)"FloatVector_swap(self, v)"},
	 { (char *)"FloatVector_get_allocator", (PyCFunction)_wrap_FloatVector_get_allocator, METH_O, (char *)"FloatVector_get_allocator(self) -> std::vector< float >::allocator_type"},
	 { (char *)"FloatVector_begin", (PyCFunction)_wrap_FloatVector_begin, METH_O, (char *)"FloatVector_begin(self) -> std::vector< float >::iterator"},
	 { (char *)"FloatVector_end", (PyCFunction)_wrap_FloatVector_end, METH_O, (char *)"FloatVector_end(self) -> std::vector< float >::iterator"},
	 { (char *)"FloatVector_rbegin", (PyCFunction)_wrap_FloatVector_rbegin, METH_O, (char *)"FloatVector_rbegin(self) -> std::vector< float >::reverse_iterator"},
	 { (char *)"FloatVector_rend", (PyCFunction)_wrap_FloatVector_rend, METH_O, (char *)"FloatVector_rend(self) -> std::vector< float >::reverse_iterator"},
	 { (char *)"FloatVector_pop_back", (PyCFunction)_wrap_FloatVector_pop_back, METH_O, (char *)"FloatVector_pop_back(self)"},
	 { (char *)"FloatVector_erase", _wrap_FloatVector_erase, METH_VARARGS, (char *)"\n"
		"erase(pos) -> std::vector< float >::iterator\n"
		"FloatVector_erase(self, first, last) -> std::vector< float >::iterator\n"
		""},
	 { (char *)"new_FloatVector", _wrap_new_FloatVector, METH_VARARGS, (char *)"\n"
		"FloatVector()\n"
		"FloatVector(arg2)\n"
		"FloatVector(size)\n"
		"new_FloatVector(size, value) -> FloatVector\n"
		""},
	 { (char *)"FloatVector_push_back", (PyCFunction) _wrap_FloatVector_push_back, METH_VARARGS | METH_KEYWORDS, (char *)"FloatVector_push_back(self, x)"},
	 { (char *)"FloatVector_front", (PyCFunction)_wrap_FloatVector_front, METH_O, (char *)"FloatVector_front(self) -> std::vector< float >::value_type const &"},
	 { (char *)"FloatVector_back", (PyCFunction)_wrap_FloatVector_back, METH_O, (char *)"FloatVector_back(self) -> std::vector< float >::value_type const &"},
	 { (char *)"FloatVector_assign", (PyCFunction) _wrap_FloatVector_assign, METH_VARARGS | METH_KEYWORDS, (char *)"FloatVector_assign(self, n, x)"},
	 { (char *)"FloatVector_resize", _wrap_FloatVector_resize, METH_VARARGS, (char *)"\n"
		"resize(new_size)\n"
		"FloatVector_resize(self, new_size, x)\n"
		""},
	 { (char *)"FloatVector_insert", _wrap_FloatVector_insert, METH_VARARGS, (char *)"\n"
		"insert(pos, x) -> std::vector< float >::iterator\n"
		"FloatVector_insert(self, pos, n, x)\n"
		""},
	 { (char *)"FloatVector_reserve", (PyCFunction) _wrap_FloatVector_reserve, METH_VARARGS | METH_KEYWORDS, (char *)"FloatVector_reserve(self, n)"},
	 { (char *)"FloatVector_capacity", (PyCFunction)_wrap_FloatVector_capacity, METH_O, (char *)"FloatVector_capacity(self) -> std::vector< float >::size_type"},
	 { (char *)"delete_FloatVector", (PyCFunction)_wrap_delete_FloatVector, METH_O, (char *)"delete_FloatVector(self)"},
	 { (char *)"FloatVector_swigregister", FloatVector_swigregister, METH_VARARGS, NULL},
	 { (char *)"DoubleVector_iterator", (PyCFunction)_wrap_DoubleVector_iterator, METH_O, (char *)"DoubleVector_iterator(self) -> SwigPyIterator"},
	 { (char *)"DoubleVector___nonzero__", (PyCFunction)_wrap_DoubleVector___nonzero__, METH_O, (char *)"DoubleVector___nonzero__(self) -> bool"},
	 { (char *)"DoubleVector___bool__", (PyCFunction)_wrap_DoubleVector___bool__, METH_O, (char *)"DoubleVector___bool__(self) -> bool"},
	 { (char *)"DoubleVector___len__", (PyCFunction)_wrap_DoubleVector___len__, METH_O, (char *)"DoubleVector___len__(self) -> std::vector< double >::size_type"},
	 { (char *)"DoubleVector_pop", (PyCFunction)_wrap_DoubleVector_pop, METH_O, (char *)"DoubleVector_pop(self) -> std::vector< double >::value_type"},
	 { (char *)"DoubleVector___getslice__", (PyCFunction) _wrap_DoubleVector___getslice__, METH_VARARGS | METH_KEYWORDS, (char *)"DoubleVector___getslice__(self, i, j) -> DoubleVector"},
	 { (char *)"DoubleVector___setslice__", (PyCFunction) _wrap_DoubleVector___setslice__, METH_VARARGS | METH_KEYWORDS, (char *)"DoubleVector___setslice__(self, i, j, v=std::vector< double,std::allocator< double > >())"},
	 { (char *)"DoubleVector___delslice__", (PyCFunction) _wrap_DoubleVector___delslice__, METH_VARARGS | METH_KEYWORDS, (char *)"DoubleVector___delslice__(self, i, j)"},
	 { (char *)"DoubleVector___delitem__", _wrap_DoubleVector___delitem__, METH_VARARGS, (char *)"\n"
		"__delitem__(i)\n"
		"DoubleVector___delitem__(self, slice)\n"
		""},
	 { (char *)"DoubleVector___getitem__", _wrap_DoubleVector___getitem__, METH_VARARGS, (char *)"\n"
		"__getitem__(slice) -> DoubleVector\n"
		"DoubleVector___getitem__(self, i) -> std::vector< double >::value_type const &\n"
		""},
	 { (char *)"DoubleVector___setitem__", _wrap_DoubleVector___setitem__, METH_VARARGS, (char *)"\n"
		"__setitem__(slice, v)\n"
		"__setitem__(slice)\n"
		"DoubleVector___setitem__(self, i, x)\n"
		""},
	 { (char *)"DoubleVector_append", (PyCFunction) _wrap_DoubleVector_append, METH_VARARGS | METH_KEYWORDS, (char *)"DoubleVector_append(self, x)"},
	 { (char *)"DoubleVector_empty", (PyCFunction)_wrap_DoubleVector_empty, METH_O, (char *)"DoubleVector_empty(self) -> bool"},
	 { (char *)"DoubleVector_size", (PyCFunction)_wrap_DoubleVector_size, METH_O, (char *)"DoubleVector_size(self) -> std::vector< double >::size_type"},
	 { (char *)"DoubleVector_clear", (PyCFunction)_wrap_DoubleVector_clear, METH_O, (char *)"DoubleVector_clear(self)"},
	 { (char *)"DoubleVector_swap", (PyCFunction) _wrap_DoubleVector_swap, METH_VARARGS | METH_KEYWORDS, (char *)"DoubleVector_swap(self, v)"},
	 { (char *)"DoubleVector_get_allocator", (PyCFunction)_wrap_DoubleVector_get_allocator, METH_O, (char *)"DoubleVector_get_allocator(self) -> std::vector< double >::allocator_type"},
	 { (char *)"DoubleVector_begin", (PyCFunction)_wrap_DoubleVector_begin, METH_O, (char *)"DoubleVector_begin(self) -> std::vector< double >::iterator"},
	 { (char *)"DoubleVector_end", (PyCFunction)_wrap_DoubleVector_end, METH_O, (char *)"DoubleVector_end(self) -> std::vector< double >::iterator"},
	 { (char *)"DoubleVector_rbegin", (PyCFunction)_wrap_DoubleVector_rbegin, METH_O, (char *)"DoubleVector_rbegin(self) -> std::vector< double >::reverse_iterator"},
	 { (char *)"DoubleVector_rend", (PyCFunction)_wrap_DoubleVector_rend, METH_O, (char *)"DoubleVector_rend(self) -> std::vector< double >::reverse_iterator"},
	 { (char *)"DoubleVector_pop_back", (PyCFunction)_wrap_DoubleVector_pop_back, METH_O, (char *)"DoubleVector_pop_back(self)"},
	 { (char *)"DoubleVector_erase", _wrap_DoubleVector_erase, METH_VARARGS, (char *)"\n"
		"erase(pos) -> std::vector< double >::iterator\n"
		"DoubleVector_erase(self, first, last) -> std::vector< double >::iterator\n"
		""},
	 { (char *)"new_DoubleVector", _wrap_new_DoubleVector, METH_VARARGS, (char *)"\n"
		"DoubleVector()\n"
		"DoubleVector(arg2)\n"
		"DoubleVector(size)\n"
		"new_DoubleVector(size, value) -> DoubleVector\n"
		""},
	 { (char *)"DoubleVector_push_back", (PyCFunction) _wrap_DoubleVector_push_back, METH_VARARGS | METH_KEYWORDS, (char *)"DoubleVector_push_back(self, x)"},
	 { (char *)"DoubleVector_front", (PyCFunction)_wrap_DoubleVector_front, METH_O, (char *)"DoubleVector_front(self) -> std::vector< double >::value_type const &"},
	 { (char *)"DoubleVector_back", (PyCFunction)_wrap_DoubleVector_back, METH_O, (char *)"DoubleVector_back(self) -> std::vector< double >::value_type const &"},
	 { (char *)"DoubleVector_assign", (PyCFunction) _wrap_DoubleVector_assign, METH_VARARGS | METH_KEYWORDS, (char *)"DoubleVector_assign(self, n, x)"},
	 { (char *)"DoubleVector_resize", _wrap_DoubleVector_resize, METH_VARARGS, (char *)"\n"
		"resize(new_size)\n"
		"DoubleVector_resize(self, new_size, x)\n"
		""},
	 { (char *)"DoubleVector_insert", _wrap_DoubleVector_insert, METH_VARARGS, (char *)"\n"
		"insert(pos, x) -> std::vector< double >::iterator\n"
		"DoubleVector_insert(self, pos, n, x)\n"
		""},
	 { (char *)"DoubleVector_reserve", (PyCFunction) _wrap_DoubleVector_reserve, METH_VARARGS | METH_KEYWORDS, (char *)"DoubleVector_reserve(self, n)"},
	 { (char *)"DoubleVector_capacity", (PyCFunction)_wrap_DoubleVector_capacity, METH_O, (char *)"DoubleVector_capacity(self) -> std::vector< double >::size_type"},
	 { (char *)"delete_DoubleVector", (PyCFunction)_wrap_delete_DoubleVector, METH_O, (char *)"delete_DoubleVector(self)"},
	 { (char *)"DoubleVector_swigregister", DoubleVector_swigregister, METH_VARARGS, NULL},
	 { (char *)"StringVector_iterator", (PyCFunction)_wrap_StringVector_iterator, METH_O, (char *)"StringVector_iterator(self) -> SwigPyIterator"},
	 { (char *)"StringVector___nonzero__", (PyCFunction)_wrap_StringVector___nonzero__, METH_O, (char *)"StringVector___nonzero__(self) -> bool"},
	 { (char *)"StringVector___bool__", (PyCFunction)_wrap_StringVector___bool__, METH_O, (char *)"StringVector___bool__(self) -> bool"},
	 { (char *)"StringVector___len__", (PyCFunction)_wrap_StringVector___len__, METH_O, (char *)"StringVector___len__(self) -> std::vector< std::string >::size_type"},
	 { (char *)"StringVector_pop", (PyCFunction)_wrap_StringVector_pop, METH_O, (char *)"StringVector_pop(self) -> std::vector< std::string >::value_type"},
	 { (char *)"StringVector___getslice__", (PyCFunction) _wrap_StringVector___getslice__, METH_VARARGS | METH_KEYWORDS, (char *)"StringVector___getslice__(self, i, j) -> StringVector"},
	 { (char *)"StringVector___setslice__", (PyCFunction) _wrap_StringVector___setslice__, METH_VARARGS | METH_KEYWORDS, (char *)"StringVector___setslice__(self, i, j, v=std::vector< std::string,std::allocator< std::string > >())"},
	 { (char *)"StringVector___delslice__", (PyCFunction) _wrap_StringVector___delslice__, METH_VARARGS | METH_KEYWORDS, (char *)"StringVector___delslice__(self, i, j)"},
	 { (char *)"StringVector___delitem__", _wrap_StringVector___delitem__, METH_VARARGS, (char *)"\n"
		"__delitem__(i)\n"
		"StringVector___delitem__(self, slice)\n"
		""},
	 { (char *)"StringVector___getitem__", _wrap_StringVector___getitem__, METH_VARARGS, (char *)"\n"
		"__getitem__(slice) -> StringVector\n"
		"StringVector___getitem__(self, i) -> std::vector< std::string >::value_type const &\n"
		""},
	 { (char *)"StringVector___setitem__", _wrap_StringVector___setitem__, METH_VARARGS, (char *)"\n"
		"__setitem__(slice, v)\n"
		"__setitem__(slice)\n"
		"StringVector___setitem__(self, i, x)\n"
		""},
	 { (char *)"StringVector_append", (PyCFunction) _wrap_StringVector_append, METH_VARARGS | METH_KEYWORDS, (char *)"StringVector_append(self, x)"},
	 { (char *)"StringVector_empty", (PyCFunction)_wrap_StringVector_empty, METH_O, (char *)"StringVector_empty(self) -> bool"},
	 { (char *)"StringVector_size", (PyCFunction)_wrap_StringVector_size, METH_O, (char *)"StringVector_size(self) -> std::vector< std::string >::size_type"},
	 { (char *)"StringVector_clear", (PyCFunction)_wrap_StringVector_clear, METH_O, (char *)"StringVector_clear(self)"},
	 { (char *)"StringVector_swap", (PyCFunction) _wrap_StringVector_swap, METH_VARARGS | METH_KEYWORDS, (char *)"StringVector_swap(self, v)"},
	 { (char *)"StringVector_get_allocator", (PyCFunction)_wrap_StringVector_get_allocator, METH_O, (char *)"StringVector_get_allocator(self) -> std::vector< std::string >::allocator_type"},
	 { (char *)"StringVector_begin", (PyCFunction)_wrap_StringVector_begin, METH_O, (char *)"StringVector_begin(self) -> std::vector< std::string >::iterator"},
	 { (char *)"StringVector_end", (PyCFunction)_wrap_StringVector_end, METH_O, (char *)"StringVector_end(self) -> std::vector< std::string >::iterator"},
	 { (char *)"StringVector_rbegin", (PyCFunction)_wrap_StringVector_rbegin, METH_O, (char *)"StringVector_rbegin(self) -> std::vector< std::string >::reverse_iterator"},
	 { (char *)"StringVector_rend", (PyCFunction)_wrap_StringVector_rend, METH_O, (char *)"StringVector_rend(self) -> std::vector< std::string >::reverse_iterator"},
	 { (char *)"StringVector_pop_back", (PyCFunction)_wrap_StringVector_pop_back, METH_O, (char *)"StringVector_pop_back(self)"},
	 { (char *)"StringVector_erase", _wrap_StringVector_erase, METH_VARARGS, (char *)"\n"
		"erase(pos) -> std::vector< std::string >::iterator\n"
		"StringVector_erase(self, first, last) -> std::vector< std::string >::iterator\n"
		""},
	 { (char *)"new_StringVector", _wrap_new_StringVector, METH_VARARGS, (char *)"\n"
		"StringVector()\n"
		"StringVector(arg2)\n"
		"StringVector(size)\n"
		"new_StringVector(size, value) -> StringVector\n"
		""},
	 { (char *)"StringVector_push_back", (PyCFunction) _wrap_StringVector_push_back, METH_VARARGS | METH_KEYWORDS, (char *)"StringVector_push_back(self, x)"},
	 { (char *)"StringVector_front", (PyCFunction)_wrap_StringVector_front, METH_O, (char *)"StringVector_front(self) -> std::vector< std::string >::value_type const &"},
	 { (char *)"StringVector_back", (PyCFunction)_wrap_StringVector_back, METH_O, (char *)"StringVector_back(self) -> std::vector< std::string >::value_type const &"},
	 { (char *)"StringVector_assign", (PyCFunction) _wrap_StringVector_assign, METH_VARARGS | METH_KEYWORDS, (char *)"StringVector_assign(self, n, x)"},
	 { (char *)"StringVector_resize", _wrap_StringVector_resize, METH_VARARGS, (char *)"\n"
		"resize(new_size)\n"
		"StringVector_resize(self, new_size, x)\n"
		""},
	 { (char *)"StringVector_insert", _wrap_StringVector_insert, METH_VARARGS, (char *)"\n"
		"insert(pos, x) -> std::vector< std::string >::iterator\n"
		"StringVector_insert(self, pos, n, x)\n"
		""},
	 { (char *)"StringVector_reserve", (PyCFunction) _wrap_StringVector_reserve, METH_VARARGS | METH_KEYWORDS, (char *)"StringVector_reserve(self, n)"},
	 { (char *)"StringVector_capacity", (PyCFunction)_wrap_StringVector_capacity, METH_O, (char *)"StringVector_capacity(self) -> std::vector< std::string >::size_type"},
	 { (char *)"delete_StringVector", (PyCFunction)_wrap_delete_StringVector, METH_O, (char *)"delete_StringVector(self)"},
	 { (char *)"StringVector_swigregister", StringVector_swigregister, METH_VARARGS, NULL},
	 { (char *)"StringList_iterator", (PyCFunction)_wrap_StringList_iterator, METH_O, (char *)"StringList_iterator(self) -> SwigPyIterator"},
	 { (char *)"StringList___nonzero__", (PyCFunction)_wrap_StringList___nonzero__, METH_O, (char *)"StringList___nonzero__(self) -> bool"},
	 { (char *)"StringList___bool__", (PyCFunction)_wrap_StringList___bool__, METH_O, (char *)"StringList___bool__(self) -> bool"},
	 { (char *)"StringList___len__", (PyCFunction)_wrap_StringList___len__, METH_O, (char *)"StringList___len__(self) -> std::list< std::string >::size_type"},
	 { (char *)"StringList_pop", (PyCFunction)_wrap_StringList_pop, METH_O, (char *)"StringList_pop(self) -> std::list< std::string >::value_type"},
	 { (char *)"StringList___getslice__", (PyCFunction) _wrap_StringList___getslice__, METH_VARARGS | METH_KEYWORDS, (char *)"StringList___getslice__(self, i, j) -> StringList"},
	 { (char *)"StringList___setslice__", (PyCFunction) _wrap_StringList___setslice__, METH_VARARGS | METH_KEYWORDS, (char *)"StringList___setslice__(self, i, j, v=std::list< std::string,std::allocator< std::string > >())"},
	 { (char *)"StringList___delslice__", (PyCFunction) _wrap_StringList___delslice__, METH_VARARGS | METH_KEYWORDS, (char *)"StringList___delslice__(self, i, j)"},
	 { (char *)"StringList___delitem__", _wrap_StringList___delitem__, METH_VARARGS, (char *)"\n"
		"__delitem__(i)\n"
		"StringList___delitem__(self, slice)\n"
		""},
	 { (char *)"StringList___getitem__", _wrap_StringList___getitem__, METH_VARARGS, (char *)"\n"
		"__getitem__(slice) -> StringList\n"
		"StringList___getitem__(self, i) -> std::list< std::string >::value_type const &\n"
		""},
	 { (char *)"StringList___setitem__", _wrap_StringList___setitem__, METH_VARARGS, (char *)"\n"
		"__setitem__(slice, v)\n"
		"__setitem__(slice)\n"
		"StringList___setitem__(self, i, x)\n"
		""},
	 { (char *)"StringList_append", (PyCFunction) _wrap_StringList_append, METH_VARARGS | METH_KEYWORDS, (char *)"StringList_append(self, x)"},
	 { (char *)"StringList_empty", (PyCFunction)_wrap_StringList_empty, METH_O, (char *)"StringList_empty(self) -> bool"},
	 { (char *)"StringList_size", (PyCFunction)_wrap_StringList_size, METH_O, (char *)"StringList_size(self) -> std::list< std::string >::size_type"},
	 { (char *)"StringList_clear", (PyCFunction)_wrap_StringList_clear, METH_O, (char *)"StringList_clear(self)"},
	 { (char *)"StringList_swap", (PyCFunction) _wrap_StringList_swap, METH_VARARGS | METH_KEYWORDS, (char *)"StringList_swap(self, v)"},
	 { (char *)"StringList_get_allocator", (PyCFunction)_wrap_StringList_get_allocator, METH_O, (char *)"StringList_get_allocator(self) -> std::list< std::string >::allocator_type"},
	 { (char *)"StringList_begin", (PyCFunction)_wrap_StringList_begin, METH_O, (char *)"StringList_begin(self) -> std::list< std::string >::iterator"},
	 { (char *)"StringList_end", (PyCFunction)_wrap_StringList_end, METH_O, (char *)"StringList_end(self) -> std::list< std::string >::iterator"},
	 { (char *)"StringList_rbegin", (PyCFunction)_wrap_StringList_rbegin, METH_O, (char *)"StringList_rbegin(self) -> std::list< std::string >::reverse_iterator"},
	 { (char *)"StringList_rend", (PyCFunction)_wrap_StringList_rend, METH_O, (char *)"StringList_rend(self) -> std::list< std::string >::reverse_iterator"},
	 { (char *)"StringList_pop_back", (PyCFunction)_wrap_StringList_pop_back, METH_O, (char *)"StringList_pop_back(self)"},
	 { (char *)"StringList_erase", _wrap_StringList_erase, METH_VARARGS, (char *)"\n"
		"erase(pos) -> std::list< std::string >::iterator\n"
		"StringList_erase(self, first, last) -> std::list< std::string >::iterator\n"
		""},
	 { (char *)"new_StringList", _wrap_new_StringList, METH_VARARGS, (char *)"\n"
		"StringList()\n"
		"StringList(arg2)\n"
		"StringList(size)\n"
		"new_StringList(size, value) -> StringList\n"
		""},
	 { (char *)"StringList_push_back", (PyCFunction) _wrap_StringList_push_back, METH_VARARGS | METH_KEYWORDS, (char *)"StringList_push_back(self, x)"},
	 { (char *)"StringList_front", (PyCFunction)_wrap_StringList_front, METH_O, (char *)"StringList_front(self) -> std::list< std::string >::value_type const &"},
	 { (char *)"StringList_back", (PyCFunction)_wrap_StringList_back, METH_O, (char *)"StringList_back(self) -> std::list< std::string >::value_type const &"},
	 { (char *)"StringList_assign", (PyCFunction) _wrap_StringList_assign, METH_VARARGS | METH_KEYWORDS, (char *)"StringList_assign(self, n, x)"},
	 { (char *)"StringList_resize", _wrap_StringList_resize, METH_VARARGS, (char *)"\n"
		"resize(new_size)\n"
		"StringList_resize(self, new_size, x)\n"
		""},
	 { (char *)"StringList_insert", _wrap_StringList_insert, METH_VARARGS, (char *)"\n"
		"insert(pos, x) -> std::list< std::string >::iterator\n"
		"StringList_insert(self, pos, n, x)\n"
		""},
	 { (char *)"StringList_pop_front", (PyCFunction)_wrap_StringList_pop_front, METH_O, (char *)"StringList_pop_front(self)"},
	 { (char *)"StringList_push_front", (PyCFunction) _wrap_StringList_push_front, METH_VARARGS | METH_KEYWORDS, (char *)"StringList_push_front(self, x)"},
	 { (char *)"StringList_reverse", (PyCFunction)_wrap_StringList_reverse, METH_O, (char *)"StringList_reverse(self)"},
	 { (char *)"delete_StringList", (PyCFunction)_wrap_delete_StringList, METH_O, (char *)"delete_StringList(self)"},
	 { (char *)"StringList_swigregister", StringList_swigregister, METH_VARARGS, NULL},
	 { (char *)"StringSet_iterator", (PyCFunction)_wrap_StringSet_iterator, METH_O, (char *)"StringSet_iterator(self) -> SwigPyIterator"},
	 { (char *)"StringSet___nonzero__", (PyCFunction)_wrap_StringSet___nonzero__, METH_O, (char *)"StringSet___nonzero__(self) -> bool"},
	 { (char *)"StringSet___bool__", (PyCFunction)_wrap_StringSet___bool__, METH_O, (char *)"StringSet___bool__(self) -> bool"},
	 { (char *)"StringSet___len__", (PyCFunction)_wrap_StringSet___len__, METH_O, (char *)"StringSet___len__(self) -> std::set< std::string >::size_type"},
	 { (char *)"StringSet_append", (PyCFunction) _wrap_StringSet_append, METH_VARARGS | METH_KEYWORDS, (char *)"StringSet_append(self, x)"},
	 { (char *)"StringSet___contains__", (PyCFunction) _wrap_StringSet___contains__, METH_VARARGS | METH_KEYWORDS, (char *)"StringSet___contains__(self, x) -> bool"},
	 { (char *)"StringSet___getitem__", (PyCFunction) _wrap_StringSet___getitem__, METH_VARARGS | METH_KEYWORDS, (char *)"StringSet___getitem__(self, i) -> std::set< std::string >::value_type"},
	 { (char *)"StringSet_add", (PyCFunction) _wrap_StringSet_add, METH_VARARGS | METH_KEYWORDS, (char *)"StringSet_add(self, x)"},
	 { (char *)"StringSet_discard", (PyCFunction) _wrap_StringSet_discard, METH_VARARGS | METH_KEYWORDS, (char *)"StringSet_discard(self, x)"},
	 { (char *)"new_StringSet", _wrap_new_StringSet, METH_VARARGS, (char *)"\n"
		"StringSet(arg2)\n"
		"StringSet()\n"
		"new_StringSet(arg1) -> StringSet\n"
		""},
	 { (char *)"StringSet_empty", (PyCFunction)_wrap_StringSet_empty, METH_O, (char *)"StringSet_empty(self) -> bool"},
	 { (char *)"StringSet_size", (PyCFunction)_wrap_StringSet_size, METH_O, (char *)"StringSet_size(self) -> std::set< std::string >::size_type"},
	 { (char *)"StringSet_clear", (PyCFunction)_wrap_StringSet_clear, METH_O, (char *)"StringSet_clear(self)"},
	 { (char *)"StringSet_swap", (PyCFunction) _wrap_StringSet_swap, METH_VARARGS | METH_KEYWORDS, (char *)"StringSet_swap(self, v)"},
	 { (char *)"StringSet_count", (PyCFunction) _wrap_StringSet_count, METH_VARARGS | METH_KEYWORDS, (char *)"StringSet_count(self, x) -> std::set< std::string >::size_type"},
	 { (char *)"StringSet_begin", (PyCFunction)_wrap_StringSet_begin, METH_O, (char *)"StringSet_begin(self) -> std::set< std::string >::iterator"},
	 { (char *)"StringSet_end", (PyCFunction)_wrap_StringSet_end, METH_O, (char *)"StringSet_end(self) -> std::set< std::string >::iterator"},
	 { (char *)"StringSet_rbegin", (PyCFunction)_wrap_StringSet_rbegin, METH_O, (char *)"StringSet_rbegin(self) -> std::set< std::string >::reverse_iterator"},
	 { (char *)"StringSet_rend", (PyCFunction)_wrap_StringSet_rend, METH_O, (char *)"StringSet_rend(self) -> std::set< std::string >::reverse_iterator"},
	 { (char *)"StringSet_erase", _wrap_StringSet_erase, METH_VARARGS, (char *)"\n"
		"erase(x) -> std::set< std::string >::size_type\n"
		"erase(pos)\n"
		"StringSet_erase(self, first, last)\n"
		""},
	 { (char *)"StringSet_find", (PyCFunction) _wrap_StringSet_find, METH_VARARGS | METH_KEYWORDS, (char *)"StringSet_find(self, x) -> std::set< std::string >::iterator"},
	 { (char *)"StringSet_lower_bound", (PyCFunction) _wrap_StringSet_lower_bound, METH_VARARGS | METH_KEYWORDS, (char *)"StringSet_lower_bound(self, x) -> std::set< std::string >::iterator"},
	 { (char *)"StringSet_upper_bound", (PyCFunction) _wrap_StringSet_upper_bound, METH_VARARGS | METH_KEYWORDS, (char *)"StringSet_upper_bound(self, x) -> std::set< std::string >::iterator"},
	 { (char *)"StringSet_equal_range", (PyCFunction) _wrap_StringSet_equal_range, METH_VARARGS | METH_KEYWORDS, (char *)"StringSet_equal_range(self, x) -> std::pair< std::set< std::string >::iterator,std::set< std::string >::iterator >"},
	 { (char *)"StringSet_insert", (PyCFunction) _wrap_StringSet_insert, METH_VARARGS | METH_KEYWORDS, (char *)"StringSet_insert(self, __x) -> std::pair< std::set< std::string >::iterator,bool >"},
	 { (char *)"delete_StringSet", (PyCFunction)_wrap_delete_StringSet, METH_O, (char *)"delete_StringSet(self)"},
	 { (char *)"StringSet_swigregister", StringSet_swigregister, METH_VARARGS, NULL},
	 { (char *)"StringMap_iterator", (PyCFunction)_wrap_StringMap_iterator, METH_O, (char *)"StringMap_iterator(self) -> SwigPyIterator"},
	 { (char *)"StringMap___nonzero__", (PyCFunction)_wrap_StringMap___nonzero__, METH_O, (char *)"StringMap___nonzero__(self) -> bool"},
	 { (char *)"StringMap___bool__", (PyCFunction)_wrap_StringMap___bool__, METH_O, (char *)"StringMap___bool__(self) -> bool"},
	 { (char *)"StringMap___len__", (PyCFunction)_wrap_StringMap___len__, METH_O, (char *)"StringMap___len__(self) -> std::map< std::string,std::string >::size_type"},
	 { (char *)"StringMap___getitem__", (PyCFunction) _wrap_StringMap___getitem__, METH_VARARGS | METH_KEYWORDS, (char *)"StringMap___getitem__(self, key) -> std::map< std::string,std::string >::mapped_type const &"},
	 { (char *)"StringMap___delitem__", (PyCFunction) _wrap_StringMap___delitem__, METH_VARARGS | METH_KEYWORDS, (char *)"StringMap___delitem__(self, key)"},
	 { (char *)"StringMap_has_key", (PyCFunction) _wrap_StringMap_has_key, METH_VARARGS | METH_KEYWORDS, (char *)"StringMap_has_key(self, key) -> bool"},
	 { (char *)"StringMap_keys", (PyCFunction)_wrap_StringMap_keys, METH_O, (char *)"StringMap_keys(self) -> PyObject *"},
	 { (char *)"StringMap_values", (PyCFunction)_wrap_StringMap_values, METH_O, (char *)"StringMap_values(self) -> PyObject *"},
	 { (char *)"StringMap_items", (PyCFunction)_wrap_StringMap_items, METH_O, (char *)"StringMap_items(self) -> PyObject *"},
	 { (char *)"StringMap___contains__", (PyCFunction) _wrap_StringMap___contains__, METH_VARARGS | METH_KEYWORDS, (char *)"StringMap___contains__(self, key) -> bool"},
	 { (char *)"StringMap_key_iterator", (PyCFunction)_wrap_StringMap_key_iterator, METH_O, (char *)"StringMap_key_iterator(self) -> SwigPyIterator"},
	 { (char *)"StringMap_value_iterator", (PyCFunction)_wrap_StringMap_value_iterator, METH_O, (char *)"StringMap_value_iterator(self) -> SwigPyIterator"},
	 { (char *)"StringMap___setitem__", _wrap_StringMap___setitem__, METH_VARARGS, (char *)"\n"
		"__setitem__(key)\n"
		"StringMap___setitem__(self, key, x)\n"
		""},
	 { (char *)"StringMap_asdict", (PyCFunction)_wrap_StringMap_asdict, METH_O, (char *)"StringMap_asdict(self) -> PyObject *"},
	 { (char *)"new_StringMap", _wrap_new_StringMap, METH_VARARGS, (char *)"\n"
		"StringMap(arg2)\n"
		"StringMap()\n"
		"new_StringMap(arg1) -> StringMap\n"
		""},
	 { (char *)"StringMap_empty", (PyCFunction)_wrap_StringMap_empty, METH_O, (char *)"StringMap_empty(self) -> bool"},
	 { (char *)"StringMap_size", (PyCFunction)_wrap_StringMap_size, METH_O, (char *)"StringMap_size(self) -> std::map< std::string,std::string >::size_type"},
	 { (char *)"StringMap_clear", (PyCFunction)_wrap_StringMap_clear, METH_O, (char *)"StringMap_clear(self)"},
	 { (char *)"StringMap_swap", (PyCFunction) _wrap_StringMap_swap, METH_VARARGS | METH_KEYWORDS, (char *)"StringMap_swap(self, v)"},
	 { (char *)"StringMap_get_allocator", (PyCFunction)_wrap_StringMap_get_allocator, METH_O, (char *)"StringMap_get_allocator(self) -> std::map< std::string,std::string >::allocator_type"},
	 { (char *)"StringMap_begin", (PyCFunction)_wrap_StringMap_begin, METH_O, (char *)"StringMap_begin(self) -> std::map< std::string,std::string >::iterator"},
	 { (char *)"StringMap_end", (PyCFunction)_wrap_StringMap_end, METH_O, (char *)"StringMap_end(self) -> std::map< std::string,std::string >::iterator"},
	 { (char *)"StringMap_rbegin", (PyCFunction)_wrap_StringMap_rbegin, METH_O, (char *)"StringMap_rbegin(self) -> std::map< std::string,std::string >::reverse_iterator"},
	 { (char *)"StringMap_rend", (PyCFunction)_wrap_StringMap_rend, METH_O, (char *)"StringMap_rend(self) -> std::map< std::string,std::string >::reverse_iterator"},
	 { (char *)"StringMap_count", (PyCFunction) _wrap_StringMap_count, METH_VARARGS | METH_KEYWORDS, (char *)"StringMap_count(self, x) -> std::map< std::string,std::string >::size_type"},
	 { (char *)"StringMap_erase", _wrap_StringMap_erase, METH_VARARGS, (char *)"\n"
		"erase(x) -> std::map< std::string,std::string >::size_type\n"
		"erase(position)\n"
		"StringMap_erase(self, first, last)\n"
		""},
	 { (char *)"StringMap_find", (PyCFunction) _wrap_StringMap_find, METH_VARARGS | METH_KEYWORDS, (char *)"StringMap_find(self, x) -> std::map< std::string,std::string >::iterator"},
	 { (char *)"StringMap_lower_bound", (PyCFunction) _wrap_StringMap_lower_bound, METH_VARARGS | METH_KEYWORDS, (char *)"StringMap_lower_bound(self, x) -> std::map< std::string,std::string >::iterator"},
	 { (char *)"StringMap_upper_bound", (PyCFunction) _wrap_StringMap_upper_bound, METH_VARARGS | METH_KEYWORDS, (char *)"StringMap_upper_bound(self, x) -> std::map< std::string,std::string >::iterator"},
	 { (char *)"delete_StringMap", (PyCFunction)_wrap_delete_StringMap, METH_O, (char *)"delete_StringMap(self)"},
	 { (char *)"StringMap_swigregister", StringMap_swigregister, METH_VARARGS, NULL},
	 { (char *)"new_StringStringPair", _wrap_new_StringStringPair, METH_VARARGS, (char *)"\n"
		"StringStringPair()\n"
		"StringStringPair(first, second)\n"
		"new_StringStringPair(p) -> StringStringPair\n"
		""},
	 { (char *)"StringStringPair_first_set", _wrap_StringStringPair_first_set, METH_VARARGS, (char *)"StringStringPair_first_set(self, first)"},
	 { (char *)"StringStringPair_first_get", (PyCFunction)_wrap_StringStringPair_first_get, METH_O, (char *)"StringStringPair_first_get(self) -> std::string const &"},
	 { (char *)"StringStringPair_second_set", _wrap_StringStringPair_second_set, METH_VARARGS, (char *)"StringStringPair_second_set(self, second)"},
	 { (char *)"StringStringPair_second_get", (PyCFunction)_wrap_StringStringPair_second_get, METH_O, (char *)"StringStringPair_second_get(self) -> std::string const &"},
	 { (char *)"delete_StringStringPair", (PyCFunction)_wrap_delete_StringStringPair, METH_O, (char *)"delete_StringStringPair(self)"},
	 { (char *)"StringStringPair_swigregister", StringStringPair_swigregister, METH_VARARGS, NULL},
	 { (char *)"StringStringList_iterator", (PyCFunction)_wrap_StringStringList_iterator, METH_O, (char *)"StringStringList_iterator(self) -> SwigPyIterator"},
	 { (char *)"StringStringList___nonzero__", (PyCFunction)_wrap_StringStringList___nonzero__, METH_O, (char *)"StringStringList___nonzero__(self) -> bool"},
	 { (char *)"StringStringList___bool__", (PyCFunction)_wrap_StringStringList___bool__, METH_O, (char *)"StringStringList___bool__(self) -> bool"},
	 { (char *)"StringStringList___len__", (PyCFunction)_wrap_StringStringList___len__, METH_O, (char *)"StringStringList___len__(self) -> std::vector< std::pair< std::string,std::string > >::size_type"},
	 { (char *)"StringStringList_pop", (PyCFunction)_wrap_StringStringList_pop, METH_O, (char *)"StringStringList_pop(self) -> StringStringPair"},
	 { (char *)"StringStringList___getslice__", (PyCFunction) _wrap_StringStringList___getslice__, METH_VARARGS | METH_KEYWORDS, (char *)"StringStringList___getslice__(self, i, j) -> StringStringList"},
	 { (char *)"StringStringList___setslice__", (PyCFunction) _wrap_StringStringList___setslice__, METH_VARARGS | METH_KEYWORDS, (char *)"StringStringList___setslice__(self, i, j, v=std::vector< std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > >())"},
	 { (char *)"StringStringList___delslice__", (PyCFunction) _wrap_StringStringList___delslice__, METH_VARARGS | METH_KEYWORDS, (char *)"StringStringList___delslice__(self, i, j)"},
	 { (char *)"StringStringList___delitem__", _wrap_StringStringList___delitem__, METH_VARARGS, (char *)"\n"
		"__delitem__(i)\n"
		"StringStringList___delitem__(self, slice)\n"
		""},
	 { (char *)"StringStringList___getitem__", _wrap_StringStringList___getitem__, METH_VARARGS, (char *)"\n"
		"__getitem__(slice) -> StringStringList\n"
		"StringStringList___getitem__(self, i) -> StringStringPair\n"
		""},
	 { (char *)"StringStringList___setitem__", _wrap_StringStringList___setitem__, METH_VARARGS, (char *)"\n"
		"__setitem__(slice, v)\n"
		"__setitem__(slice)\n"
		"StringStringList___setitem__(self, i, x)\n"
		""},
	 { (char *)"StringStringList_append", (PyCFunction) _wrap_StringStringList_append, METH_VARARGS | METH_KEYWORDS, (char *)"StringStringList_append(self, x)"},
	 { (char *)"StringStringList_empty", (PyCFunction)_wrap_StringStringList_empty, METH_O, (char *)"StringStringList_empty(self) -> bool"},
	 { (char *)"StringStringList_size", (PyCFunction)_wrap_StringStringList_size, METH_O, (char *)"StringStringList_size(self) -> std::vector< std::pair< std::string,std::string > >::size_type"},
	 { (char *)"StringStringList_clear", (PyCFunction)_wrap_StringStringList_clear, METH_O, (char *)"StringStringList_clear(self)"},
	 { (char *)"StringStringList_swap", (PyCFunction) _wrap_StringStringList_swap, METH_VARARGS | METH_KEYWORDS, (char *)"StringStringList_swap(self, v)"},
	 { (char *)"StringStringList_get_allocator", (PyCFunction)_wrap_StringStringList_get_allocator, METH_O, (char *)"StringStringList_get_allocator(self) -> std::vector< std::pair< std::string,std::string > >::allocator_type"},
	 { (char *)"StringStringList_begin", (PyCFunction)_wrap_StringStringList_begin, METH_O, (char *)"StringStringList_begin(self) -> std::vector< std::pair< std::string,std::string > >::iterator"},
	 { (char *)"StringStringList_end", (PyCFunction)_wrap_StringStringList_end, METH_O, (char *)"StringStringList_end(self) -> std::vector< std::pair< std::string,std::string > >::iterator"},
	 { (char *)"StringStringList_rbegin", (PyCFunction)_wrap_StringStringList_rbegin, METH_O, (char *)"StringStringList_rbegin(self) -> std::vector< std::pair< std::string,std::string > >::reverse_iterator"},
	 { (char *)"StringStringList_rend", (PyCFunction)_wrap_StringStringList_rend, METH_O, (char *)"StringStringList_rend(self) -> std::vector< std::pair< std::string,std::string > >::reverse_iterator"},
	 { (char *)"StringStringList_pop_back", (PyCFunction)_wrap_StringStringList_pop_back, METH_O, (char *)"StringStringList_pop_back(self)"},
	 { (char *)"StringStringList_erase", _wrap_StringStringList_erase, METH_VARARGS, (char *)"\n"
		"erase(pos) -> std::vector< std::pair< std::string,std::string > >::iterator\n"
		"StringStringList_erase(self, first, last) -> std::vector< std::pair< std::string,std::string > >::iterator\n"
		""},
	 { (char *)"new_StringStringList", _wrap_new_StringStringList, METH_VARARGS, (char *)"\n"
		"StringStringList()\n"
		"StringStringList(arg2)\n"
		"StringStringList(size)\n"
		"new_StringStringList(size, value) -> StringStringList\n"
		""},
	 { (char *)"StringStringList_push_back", (PyCFunction) _wrap_StringStringList_push_back, METH_VARARGS | METH_KEYWORDS, (char *)"StringStringList_push_back(self, x)"},
	 { (char *)"StringStringList_front", (PyCFunction)_wrap_StringStringList_front, METH_O, (char *)"StringStringList_front(self) -> StringStringPair"},
	 { (char *)"StringStringList_back", (PyCFunction)_wrap_StringStringList_back, METH_O, (char *)"StringStringList_back(self) -> StringStringPair"},
	 { (char *)"StringStringList_assign", (PyCFunction) _wrap_StringStringList_assign, METH_VARARGS | METH_KEYWORDS, (char *)"StringStringList_assign(self, n, x)"},
	 { (char *)"StringStringList_resize", _wrap_StringStringList_resize, METH_VARARGS, (char *)"\n"
		"resize(new_size)\n"
		"StringStringList_resize(self, new_size, x)\n"
		""},
	 { (char *)"StringStringList_insert", _wrap_StringStringList_insert, METH_VARARGS, (char *)"\n"
		"insert(pos, x) -> std::vector< std::pair< std::string,std::string > >::iterator\n"
		"StringStringList_insert(self, pos, n, x)\n"
		""},
	 { (char *)"StringStringList_reserve", (PyCFunction) _wrap_StringStringList_reserve, METH_VARARGS | METH_KEYWORDS, (char *)"StringStringList_reserve(self, n)"},
	 { (char *)"StringStringList_capacity", (PyCFunction)_wrap_StringStringList_capacity, METH_O, (char *)"StringStringList_capacity(self) -> std::vector< std::pair< std::string,std::string > >::size_type"},
	 { (char *)"delete_StringStringList", (PyCFunction)_wrap_delete_StringStringList, METH_O, (char *)"delete_StringStringList(self)"},
	 { (char *)"StringStringList_swigregister", StringStringList_swigregister, METH_VARARGS, NULL},
	 { (char *)"StringMapList_iterator", (PyCFunction)_wrap_StringMapList_iterator, METH_O, (char *)"StringMapList_iterator(self) -> SwigPyIterator"},
	 { (char *)"StringMapList___nonzero__", (PyCFunction)_wrap_StringMapList___nonzero__, METH_O, (char *)"StringMapList___nonzero__(self) -> bool"},
	 { (char *)"StringMapList___bool__", (PyCFunction)_wrap_StringMapList___bool__, METH_O, (char *)"StringMapList___bool__(self) -> bool"},
	 { (char *)"StringMapList___len__", (PyCFunction)_wrap_StringMapList___len__, METH_O, (char *)"StringMapList___len__(self) -> std::vector< std::map< std::string,std::string > >::size_type"},
	 { (char *)"StringMapList_pop", (PyCFunction)_wrap_StringMapList_pop, METH_O, (char *)"StringMapList_pop(self) -> StringMap"},
	 { (char *)"StringMapList___getslice__", (PyCFunction) _wrap_StringMapList___getslice__, METH_VARARGS | METH_KEYWORDS, (char *)"StringMapList___getslice__(self, i, j) -> StringMapList"},
	 { (char *)"StringMapList___setslice__", (PyCFunction) _wrap_StringMapList___setslice__, METH_VARARGS | METH_KEYWORDS, (char *)"StringMapList___setslice__(self, i, j, v=std::vector< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > >())"},
	 { (char *)"StringMapList___delslice__", (PyCFunction) _wrap_StringMapList___delslice__, METH_VARARGS | METH_KEYWORDS, (char *)"StringMapList___delslice__(self, i, j)"},
	 { (char *)"StringMapList___delitem__", _wrap_StringMapList___delitem__, METH_VARARGS, (char *)"\n"
		"__delitem__(i)\n"
		"StringMapList___delitem__(self, slice)\n"
		""},
	 { (char *)"StringMapList___getitem__", _wrap_StringMapList___getitem__, METH_VARARGS, (char *)"\n"
		"__getitem__(slice) -> StringMapList\n"
		"StringMapList___getitem__(self, i) -> StringMap\n"
		""},
	 { (char *)"StringMapList___setitem__", _wrap_StringMapList___setitem__, METH_VARARGS, (char *)"\n"
		"__setitem__(slice, v)\n"
		"__setitem__(slice)\n"
		"StringMapList___setitem__(self, i, x)\n"
		""},
	 { (char *)"StringMapList_append", (PyCFunction) _wrap_StringMapList_append, METH_VARARGS | METH_KEYWORDS, (char *)"StringMapList_append(self, x)"},
	 { (char *)"StringMapList_empty", (PyCFunction)_wrap_StringMapList_empty, METH_O, (char *)"StringMapList_empty(self) -> bool"},
	 { (char *)"StringMapList_size", (PyCFunction)_wrap_StringMapList_size, METH_O, (char *)"StringMapList_size(self) -> std::vector< std::map< std::string,std::string > >::size_type"},
	 { (char *)"StringMapList_clear", (PyCFunction)_wrap_StringMapList_clear, METH_O, (char *)"StringMapList_clear(self)"},
	 { (char *)"StringMapList_swap", (PyCFunction) _wrap_StringMapList_swap, METH_VARARGS | METH_KEYWORDS, (char *)"StringMapList_swap(self, v)"},
	 { (char *)"StringMapList_get_allocator", (PyCFunction)_wrap_StringMapList_get_allocator, METH_O, (char *)"StringMapList_get_allocator(self) -> std::vector< std::map< std::string,std::string > >::allocator_type"},
	 { (char *)"StringMapList_begin", (PyCFunction)_wrap_StringMapList_begin, METH_O, (char *)"StringMapList_begin(self) -> std::vector< std::map< std::string,std::string > >::iterator"},
	 { (char *)"StringMapList_end", (PyCFunction)_wrap_StringMapList_end, METH_O, (char *)"StringMapList_end(self) -> std::vector< std::map< std::string,std::string > >::iterator"},
	 { (char *)"StringMapList_rbegin", (PyCFunction)_wrap_StringMapList_rbegin, METH_O, (char *)"StringMapList_rbegin(self) -> std::vector< std::map< std::string,std::string > >::reverse_iterator"},
	 { (char *)"StringMapList_rend", (PyCFunction)_wrap_StringMapList_rend, METH_O, (char *)"StringMapList_rend(self) -> std::vector< std::map< std::string,std::string > >::reverse_iterator"},
	 { (char *)"StringMapList_pop_back", (PyCFunction)_wrap_StringMapList_pop_back, METH_O, (char *)"StringMapList_pop_back(self)"},
	 { (char *)"StringMapList_erase", _wrap_StringMapList_erase, METH_VARARGS, (char *)"\n"
		"erase(pos) -> std::vector< std::map< std::string,std::string > >::iterator\n"
		"StringMapList_erase(self, first, last) -> std::vector< std::map< std::string,std::string > >::iterator\n"
		""},
	 { (char *)"new_StringMapList", _wrap_new_StringMapList, METH_VARARGS, (char *)"\n"
		"StringMapList()\n"
		"StringMapList(arg2)\n"
		"StringMapList(size)\n"
		"new_StringMapList(size, value) -> StringMapList\n"
		""},
	 { (char *)"StringMapList_push_back", (PyCFunction) _wrap_StringMapList_push_back, METH_VARARGS | METH_KEYWORDS, (char *)"StringMapList_push_back(self, x)"},
	 { (char *)"StringMapList_front", (PyCFunction)_wrap_StringMapList_front, METH_O, (char *)"StringMapList_front(self) -> StringMap"},
	 { (char *)"StringMapList_back", (PyCFunction)_wrap_StringMapList_back, METH_O, (char *)"StringMapList_back(self) -> StringMap"},
	 { (char *)"StringMapList_assign", (PyCFunction) _wrap_StringMapList_assign, METH_VARARGS | METH_KEYWORDS, (char *)"StringMapList_assign(self, n, x)"},
	 { (char *)"StringMapList_resize", _wrap_StringMapList_resize, METH_VARARGS, (char *)"\n"
		"resize(new_size)\n"
		"StringMapList_resize(self, new_size, x)\n"
		""},
	 { (char *)"StringMapList_insert", _wrap_StringMapList_insert, METH_VARARGS, (char *)"\n"
		"insert(pos, x) -> std::vector< std::map< std::string,std::string > >::iterator\n"
		"StringMapList_insert(self, pos, n, x)\n"
		""},
	 { (char *)"StringMapList_reserve", (PyCFunction) _wrap_StringMapList_reserve, METH_VARARGS | METH_KEYWORDS, (char *)"StringMapList_reserve(self, n)"},
	 { (char *)"StringMapList_capacity", (PyCFunction)_wrap_StringMapList_capacity, METH_O, (char *)"StringMapList_capacity(self) -> std::vector< std::map< std::string,std::string > >::size_type"},
	 { (char *)"delete_StringMapList", (PyCFunction)_wrap_delete_StringMapList, METH_O, (char *)"delete_StringMapList(self)"},
	 { (char *)"StringMapList_swigregister", StringMapList_swigregister, METH_VARARGS, NULL},
	 { (char *)"new_StringIntPair", _wrap_new_StringIntPair, METH_VARARGS, (char *)"\n"
		"StringIntPair()\n"
		"StringIntPair(first, second)\n"
		"new_StringIntPair(p) -> StringIntPair\n"
		""},
	 { (char *)"StringIntPair_first_set", _wrap_StringIntPair_first_set, METH_VARARGS, (char *)"StringIntPair_first_set(self, first)"},
	 { (char *)"StringIntPair_first_get", (PyCFunction)_wrap_StringIntPair_first_get, METH_O, (char *)"StringIntPair_first_get(self) -> std::string const &"},
	 { (char *)"StringIntPair_second_set", _wrap_StringIntPair_second_set, METH_VARARGS, (char *)"StringIntPair_second_set(self, second)"},
	 { (char *)"StringIntPair_second_get", (PyCFunction)_wrap_StringIntPair_second_get, METH_O, (char *)"StringIntPair_second_get(self) -> int"},
	 { (char *)"delete_StringIntPair", (PyCFunction)_wrap_delete_StringIntPair, METH_O, (char *)"delete_StringIntPair(self)"},
	 { (char *)"StringIntPair_swigregister", StringIntPair_swigregister, METH_VARARGS, NULL},
	 { (char *)"new_PairOfUInt32", _wrap_new_PairOfUInt32, METH_VARARGS, (char *)"\n"
		"PairOfUInt32()\n"
		"PairOfUInt32(first, second)\n"
		"new_PairOfUInt32(p) -> PairOfUInt32\n"
		""},
	 { (char *)"PairOfUInt32_first_set", _wrap_PairOfUInt32_first_set, METH_VARARGS, (char *)"PairOfUInt32_first_set(self, first)"},
	 { (char *)"PairOfUInt32_first_get", (PyCFunction)_wrap_PairOfUInt32_first_get, METH_O, (char *)"PairOfUInt32_first_get(self) -> unsigned int"},
	 { (char *)"PairOfUInt32_second_set", _wrap_PairOfUInt32_second_set, METH_VARARGS, (char *)"PairOfUInt32_second_set(self, second)"},
	 { (char *)"PairOfUInt32_second_get", (PyCFunction)_wrap_PairOfUInt32_second_get, METH_O, (char *)"PairOfUInt32_second_get(self) -> unsigned int"},
	 { (char *)"delete_PairOfUInt32", (PyCFunction)_wrap_delete_PairOfUInt32, METH_O, (char *)"delete_PairOfUInt32(self)"},
	 { (char *)"PairOfUInt32_swigregister", PairOfUInt32_swigregister, METH_VARARGS, NULL},
	 { (char *)"VectorOfPairsOfUInt32_iterator", (PyCFunction)_wrap_VectorOfPairsOfUInt32_iterator, METH_O, (char *)"VectorOfPairsOfUInt32_iterator(self) -> SwigPyIterator"},
	 { (char *)"VectorOfPairsOfUInt32___nonzero__", (PyCFunction)_wrap_VectorOfPairsOfUInt32___nonzero__, METH_O, (char *)"VectorOfPairsOfUInt32___nonzero__(self) -> bool"},
	 { (char *)"VectorOfPairsOfUInt32___bool__", (PyCFunction)_wrap_VectorOfPairsOfUInt32___bool__, METH_O, (char *)"VectorOfPairsOfUInt32___bool__(self) -> bool"},
	 { (char *)"VectorOfPairsOfUInt32___len__", (PyCFunction)_wrap_VectorOfPairsOfUInt32___len__, METH_O, (char *)"VectorOfPairsOfUInt32___len__(self) -> std::vector< std::pair< unsigned int,unsigned int > >::size_type"},
	 { (char *)"VectorOfPairsOfUInt32_pop", (PyCFunction)_wrap_VectorOfPairsOfUInt32_pop, METH_O, (char *)"VectorOfPairsOfUInt32_pop(self) -> PairOfUInt32"},
	 { (char *)"VectorOfPairsOfUInt32___getslice__", (PyCFunction) _wrap_VectorOfPairsOfUInt32___getslice__, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfPairsOfUInt32___getslice__(self, i, j) -> VectorOfPairsOfUInt32"},
	 { (char *)"VectorOfPairsOfUInt32___setslice__", (PyCFunction) _wrap_VectorOfPairsOfUInt32___setslice__, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfPairsOfUInt32___setslice__(self, i, j, v=std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >())"},
	 { (char *)"VectorOfPairsOfUInt32___delslice__", (PyCFunction) _wrap_VectorOfPairsOfUInt32___delslice__, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfPairsOfUInt32___delslice__(self, i, j)"},
	 { (char *)"VectorOfPairsOfUInt32___delitem__", _wrap_VectorOfPairsOfUInt32___delitem__, METH_VARARGS, (char *)"\n"
		"__delitem__(i)\n"
		"VectorOfPairsOfUInt32___delitem__(self, slice)\n"
		""},
	 { (char *)"VectorOfPairsOfUInt32___getitem__", _wrap_VectorOfPairsOfUInt32___getitem__, METH_VARARGS, (char *)"\n"
		"__getitem__(slice) -> VectorOfPairsOfUInt32\n"
		"VectorOfPairsOfUInt32___getitem__(self, i) -> PairOfUInt32\n"
		""},
	 { (char *)"VectorOfPairsOfUInt32___setitem__", _wrap_VectorOfPairsOfUInt32___setitem__, METH_VARARGS, (char *)"\n"
		"__setitem__(slice, v)\n"
		"__setitem__(slice)\n"
		"VectorOfPairsOfUInt32___setitem__(self, i, x)\n"
		""},
	 { (char *)"VectorOfPairsOfUInt32_append", (PyCFunction) _wrap_VectorOfPairsOfUInt32_append, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfPairsOfUInt32_append(self, x)"},
	 { (char *)"VectorOfPairsOfUInt32_empty", (PyCFunction)_wrap_VectorOfPairsOfUInt32_empty, METH_O, (char *)"VectorOfPairsOfUInt32_empty(self) -> bool"},
	 { (char *)"VectorOfPairsOfUInt32_size", (PyCFunction)_wrap_VectorOfPairsOfUInt32_size, METH_O, (char *)"VectorOfPairsOfUInt32_size(self) -> std::vector< std::pair< unsigned int,unsigned int > >::size_type"},
	 { (char *)"VectorOfPairsOfUInt32_clear", (PyCFunction)_wrap_VectorOfPairsOfUInt32_clear, METH_O, (char *)"VectorOfPairsOfUInt32_clear(self)"},
	 { (char *)"VectorOfPairsOfUInt32_swap", (PyCFunction) _wrap_VectorOfPairsOfUInt32_swap, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfPairsOfUInt32_swap(self, v)"},
	 { (char *)"VectorOfPairsOfUInt32_get_allocator", (PyCFunction)_wrap_VectorOfPairsOfUInt32_get_allocator, METH_O, (char *)"VectorOfPairsOfUInt32_get_allocator(self) -> std::vector< std::pair< unsigned int,unsigned int > >::allocator_type"},
	 { (char *)"VectorOfPairsOfUInt32_begin", (PyCFunction)_wrap_VectorOfPairsOfUInt32_begin, METH_O, (char *)"VectorOfPairsOfUInt32_begin(self) -> std::vector< std::pair< unsigned int,unsigned int > >::iterator"},
	 { (char *)"VectorOfPairsOfUInt32_end", (PyCFunction)_wrap_VectorOfPairsOfUInt32_end, METH_O, (char *)"VectorOfPairsOfUInt32_end(self) -> std::vector< std::pair< unsigned int,unsigned int > >::iterator"},
	 { (char *)"VectorOfPairsOfUInt32_rbegin", (PyCFunction)_wrap_VectorOfPairsOfUInt32_rbegin, METH_O, (char *)"VectorOfPairsOfUInt32_rbegin(self) -> std::vector< std::pair< unsigned int,unsigned int > >::reverse_iterator"},
	 { (char *)"VectorOfPairsOfUInt32_rend", (PyCFunction)_wrap_VectorOfPairsOfUInt32_rend, METH_O, (char *)"VectorOfPairsOfUInt32_rend(self) -> std::vector< std::pair< unsigned int,unsigned int > >::reverse_iterator"},
	 { (char *)"VectorOfPairsOfUInt32_pop_back", (PyCFunction)_wrap_VectorOfPairsOfUInt32_pop_back, METH_O, (char *)"VectorOfPairsOfUInt32_pop_back(self)"},
	 { (char *)"VectorOfPairsOfUInt32_erase", _wrap_VectorOfPairsOfUInt32_erase, METH_VARARGS, (char *)"\n"
		"erase(pos) -> std::vector< std::pair< unsigned int,unsigned int > >::iterator\n"
		"VectorOfPairsOfUInt32_erase(self, first, last) -> std::vector< std::pair< unsigned int,unsigned int > >::iterator\n"
		""},
	 { (char *)"new_VectorOfPairsOfUInt32", _wrap_new_VectorOfPairsOfUInt32, METH_VARARGS, (char *)"\n"
		"VectorOfPairsOfUInt32()\n"
		"VectorOfPairsOfUInt32(arg2)\n"
		"VectorOfPairsOfUInt32(size)\n"
		"new_VectorOfPairsOfUInt32(size, value) -> VectorOfPairsOfUInt32\n"
		""},
	 { (char *)"VectorOfPairsOfUInt32_push_back", (PyCFunction) _wrap_VectorOfPairsOfUInt32_push_back, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfPairsOfUInt32_push_back(self, x)"},
	 { (char *)"VectorOfPairsOfUInt32_front", (PyCFunction)_wrap_VectorOfPairsOfUInt32_front, METH_O, (char *)"VectorOfPairsOfUInt32_front(self) -> PairOfUInt32"},
	 { (char *)"VectorOfPairsOfUInt32_back", (PyCFunction)_wrap_VectorOfPairsOfUInt32_back, METH_O, (char *)"VectorOfPairsOfUInt32_back(self) -> PairOfUInt32"},
	 { (char *)"VectorOfPairsOfUInt32_assign", (PyCFunction) _wrap_VectorOfPairsOfUInt32_assign, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfPairsOfUInt32_assign(self, n, x)"},
	 { (char *)"VectorOfPairsOfUInt32_resize", _wrap_VectorOfPairsOfUInt32_resize, METH_VARARGS, (char *)"\n"
		"resize(new_size)\n"
		"VectorOfPairsOfUInt32_resize(self, new_size, x)\n"
		""},
	 { (char *)"VectorOfPairsOfUInt32_insert", _wrap_VectorOfPairsOfUInt32_insert, METH_VARARGS, (char *)"\n"
		"insert(pos, x) -> std::vector< std::pair< unsigned int,unsigned int > >::iterator\n"
		"VectorOfPairsOfUInt32_insert(self, pos, n, x)\n"
		""},
	 { (char *)"VectorOfPairsOfUInt32_reserve", (PyCFunction) _wrap_VectorOfPairsOfUInt32_reserve, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfPairsOfUInt32_reserve(self, n)"},
	 { (char *)"VectorOfPairsOfUInt32_capacity", (PyCFunction)_wrap_VectorOfPairsOfUInt32_capacity, METH_O, (char *)"VectorOfPairsOfUInt32_capacity(self) -> std::vector< std::pair< unsigned int,unsigned int > >::size_type"},
	 { (char *)"delete_VectorOfPairsOfUInt32", (PyCFunction)_wrap_delete_VectorOfPairsOfUInt32, METH_O, (char *)"delete_VectorOfPairsOfUInt32(self)"},
	 { (char *)"VectorOfPairsOfUInt32_swigregister", VectorOfPairsOfUInt32_swigregister, METH_VARARGS, NULL},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32_iterator", (PyCFunction)_wrap_VectorOfVectorsOfPairsOfUInt32_iterator, METH_O, (char *)"VectorOfVectorsOfPairsOfUInt32_iterator(self) -> SwigPyIterator"},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32___nonzero__", (PyCFunction)_wrap_VectorOfVectorsOfPairsOfUInt32___nonzero__, METH_O, (char *)"VectorOfVectorsOfPairsOfUInt32___nonzero__(self) -> bool"},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32___bool__", (PyCFunction)_wrap_VectorOfVectorsOfPairsOfUInt32___bool__, METH_O, (char *)"VectorOfVectorsOfPairsOfUInt32___bool__(self) -> bool"},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32___len__", (PyCFunction)_wrap_VectorOfVectorsOfPairsOfUInt32___len__, METH_O, (char *)"VectorOfVectorsOfPairsOfUInt32___len__(self) -> std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type"},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32_pop", (PyCFunction)_wrap_VectorOfVectorsOfPairsOfUInt32_pop, METH_O, (char *)"VectorOfVectorsOfPairsOfUInt32_pop(self) -> VectorOfPairsOfUInt32"},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32___getslice__", (PyCFunction) _wrap_VectorOfVectorsOfPairsOfUInt32___getslice__, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfVectorsOfPairsOfUInt32___getslice__(self, i, j) -> VectorOfVectorsOfPairsOfUInt32"},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32___setslice__", (PyCFunction) _wrap_VectorOfVectorsOfPairsOfUInt32___setslice__, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfVectorsOfPairsOfUInt32___setslice__(self, i, j, v=std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > >())"},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32___delslice__", (PyCFunction) _wrap_VectorOfVectorsOfPairsOfUInt32___delslice__, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfVectorsOfPairsOfUInt32___delslice__(self, i, j)"},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32___delitem__", _wrap_VectorOfVectorsOfPairsOfUInt32___delitem__, METH_VARARGS, (char *)"\n"
		"__delitem__(i)\n"
		"VectorOfVectorsOfPairsOfUInt32___delitem__(self, slice)\n"
		""},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32___getitem__", _wrap_VectorOfVectorsOfPairsOfUInt32___getitem__, METH_VARARGS, (char *)"\n"
		"__getitem__(slice) -> VectorOfVectorsOfPairsOfUInt32\n"
		"VectorOfVectorsOfPairsOfUInt32___getitem__(self, i) -> VectorOfPairsOfUInt32\n"
		""},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32___setitem__", _wrap_VectorOfVectorsOfPairsOfUInt32___setitem__, METH_VARARGS, (char *)"\n"
		"__setitem__(slice, v)\n"
		"__setitem__(slice)\n"
		"VectorOfVectorsOfPairsOfUInt32___setitem__(self, i, x)\n"
		""},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32_append", (PyCFunction) _wrap_VectorOfVectorsOfPairsOfUInt32_append, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfVectorsOfPairsOfUInt32_append(self, x)"},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32_empty", (PyCFunction)_wrap_VectorOfVectorsOfPairsOfUInt32_empty, METH_O, (char *)"VectorOfVectorsOfPairsOfUInt32_empty(self) -> bool"},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32_size", (PyCFunction)_wrap_VectorOfVectorsOfPairsOfUInt32_size, METH_O, (char *)"VectorOfVectorsOfPairsOfUInt32_size(self) -> std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type"},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32_clear", (PyCFunction)_wrap_VectorOfVectorsOfPairsOfUInt32_clear, METH_O, (char *)"VectorOfVectorsOfPairsOfUInt32_clear(self)"},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32_swap", (PyCFunction) _wrap_VectorOfVectorsOfPairsOfUInt32_swap, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfVectorsOfPairsOfUInt32_swap(self, v)"},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32_get_allocator", (PyCFunction)_wrap_VectorOfVectorsOfPairsOfUInt32_get_allocator, METH_O, (char *)"VectorOfVectorsOfPairsOfUInt32_get_allocator(self) -> std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::allocator_type"},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32_begin", (PyCFunction)_wrap_VectorOfVectorsOfPairsOfUInt32_begin, METH_O, (char *)"VectorOfVectorsOfPairsOfUInt32_begin(self) -> std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator"},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32_end", (PyCFunction)_wrap_VectorOfVectorsOfPairsOfUInt32_end, METH_O, (char *)"VectorOfVectorsOfPairsOfUInt32_end(self) -> std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator"},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32_rbegin", (PyCFunction)_wrap_VectorOfVectorsOfPairsOfUInt32_rbegin, METH_O, (char *)"VectorOfVectorsOfPairsOfUInt32_rbegin(self) -> std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::reverse_iterator"},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32_rend", (PyCFunction)_wrap_VectorOfVectorsOfPairsOfUInt32_rend, METH_O, (char *)"VectorOfVectorsOfPairsOfUInt32_rend(self) -> std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::reverse_iterator"},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32_pop_back", (PyCFunction)_wrap_VectorOfVectorsOfPairsOfUInt32_pop_back, METH_O, (char *)"VectorOfVectorsOfPairsOfUInt32_pop_back(self)"},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32_erase", _wrap_VectorOfVectorsOfPairsOfUInt32_erase, METH_VARARGS, (char *)"\n"
		"erase(pos) -> std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator\n"
		"VectorOfVectorsOfPairsOfUInt32_erase(self, first, last) -> std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator\n"
		""},
	 { (char *)"new_VectorOfVectorsOfPairsOfUInt32", _wrap_new_VectorOfVectorsOfPairsOfUInt32, METH_VARARGS, (char *)"\n"
		"VectorOfVectorsOfPairsOfUInt32()\n"
		"VectorOfVectorsOfPairsOfUInt32(arg2)\n"
		"VectorOfVectorsOfPairsOfUInt32(size)\n"
		"new_VectorOfVectorsOfPairsOfUInt32(size, value) -> VectorOfVectorsOfPairsOfUInt32\n"
		""},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32_push_back", (PyCFunction) _wrap_VectorOfVectorsOfPairsOfUInt32_push_back, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfVectorsOfPairsOfUInt32_push_back(self, x)"},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32_front", (PyCFunction)_wrap_VectorOfVectorsOfPairsOfUInt32_front, METH_O, (char *)"VectorOfVectorsOfPairsOfUInt32_front(self) -> VectorOfPairsOfUInt32"},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32_back", (PyCFunction)_wrap_VectorOfVectorsOfPairsOfUInt32_back, METH_O, (char *)"VectorOfVectorsOfPairsOfUInt32_back(self) -> VectorOfPairsOfUInt32"},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32_assign", (PyCFunction) _wrap_VectorOfVectorsOfPairsOfUInt32_assign, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfVectorsOfPairsOfUInt32_assign(self, n, x)"},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32_resize", _wrap_VectorOfVectorsOfPairsOfUInt32_resize, METH_VARARGS, (char *)"\n"
		"resize(new_size)\n"
		"VectorOfVectorsOfPairsOfUInt32_resize(self, new_size, x)\n"
		""},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32_insert", _wrap_VectorOfVectorsOfPairsOfUInt32_insert, METH_VARARGS, (char *)"\n"
		"insert(pos, x) -> std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator\n"
		"VectorOfVectorsOfPairsOfUInt32_insert(self, pos, n, x)\n"
		""},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32_reserve", (PyCFunction) _wrap_VectorOfVectorsOfPairsOfUInt32_reserve, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfVectorsOfPairsOfUInt32_reserve(self, n)"},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32_capacity", (PyCFunction)_wrap_VectorOfVectorsOfPairsOfUInt32_capacity, METH_O, (char *)"VectorOfVectorsOfPairsOfUInt32_capacity(self) -> std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type"},
	 { (char *)"delete_VectorOfVectorsOfPairsOfUInt32", (PyCFunction)_wrap_delete_VectorOfVectorsOfPairsOfUInt32, METH_O, (char *)"delete_VectorOfVectorsOfPairsOfUInt32(self)"},
	 { (char *)"VectorOfVectorsOfPairsOfUInt32_swigregister", VectorOfVectorsOfPairsOfUInt32_swigregister, METH_VARARGS, NULL},
	 { (char *)"new_PairUInt32Real32", _wrap_new_PairUInt32Real32, METH_VARARGS, (char *)"\n"
		"PairUInt32Real32()\n"
		"PairUInt32Real32(first, second)\n"
		"new_PairUInt32Real32(p) -> PairUInt32Real32\n"
		""},
	 { (char *)"PairUInt32Real32_first_set", _wrap_PairUInt32Real32_first_set, METH_VARARGS, (char *)"PairUInt32Real32_first_set(self, first)"},
	 { (char *)"PairUInt32Real32_first_get", (PyCFunction)_wrap_PairUInt32Real32_first_get, METH_O, (char *)"PairUInt32Real32_first_get(self) -> unsigned int"},
	 { (char *)"PairUInt32Real32_second_set", _wrap_PairUInt32Real32_second_set, METH_VARARGS, (char *)"PairUInt32Real32_second_set(self, second)"},
	 { (char *)"PairUInt32Real32_second_get", (PyCFunction)_wrap_PairUInt32Real32_second_get, METH_O, (char *)"PairUInt32Real32_second_get(self) -> float"},
	 { (char *)"delete_PairUInt32Real32", (PyCFunction)_wrap_delete_PairUInt32Real32, METH_O, (char *)"delete_PairUInt32Real32(self)"},
	 { (char *)"PairUInt32Real32_swigregister", PairUInt32Real32_swigregister, METH_VARARGS, NULL},
	 { (char *)"new_PairUInt32Real64", _wrap_new_PairUInt32Real64, METH_VARARGS, (char *)"\n"
		"PairUInt32Real64()\n"
		"PairUInt32Real64(first, second)\n"
		"new_PairUInt32Real64(p) -> PairUInt32Real64\n"
		""},
	 { (char *)"PairUInt32Real64_first_set", _wrap_PairUInt32Real64_first_set, METH_VARARGS, (char *)"PairUInt32Real64_first_set(self, first)"},
	 { (char *)"PairUInt32Real64_first_get", (PyCFunction)_wrap_PairUInt32Real64_first_get, METH_O, (char *)"PairUInt32Real64_first_get(self) -> unsigned int"},
	 { (char *)"PairUInt32Real64_second_set", _wrap_PairUInt32Real64_second_set, METH_VARARGS, (char *)"PairUInt32Real64_second_set(self, second)"},
	 { (char *)"PairUInt32Real64_second_get", (PyCFunction)_wrap_PairUInt32Real64_second_get, METH_O, (char *)"PairUInt32Real64_second_get(self) -> double"},
	 { (char *)"delete_PairUInt32Real64", (PyCFunction)_wrap_delete_PairUInt32Real64, METH_O, (char *)"delete_PairUInt32Real64(self)"},
	 { (char *)"PairUInt32Real64_swigregister", PairUInt32Real64_swigregister, METH_VARARGS, NULL},
	 { (char *)"VectorOfPairsUInt32Real32_iterator", (PyCFunction)_wrap_VectorOfPairsUInt32Real32_iterator, METH_O, (char *)"VectorOfPairsUInt32Real32_iterator(self) -> SwigPyIterator"},
	 { (char *)"VectorOfPairsUInt32Real32___nonzero__", (PyCFunction)_wrap_VectorOfPairsUInt32Real32___nonzero__, METH_O, (char *)"VectorOfPairsUInt32Real32___nonzero__(self) -> bool"},
	 { (char *)"VectorOfPairsUInt32Real32___bool__", (PyCFunction)_wrap_VectorOfPairsUInt32Real32___bool__, METH_O, (char *)"VectorOfPairsUInt32Real32___bool__(self) -> bool"},
	 { (char *)"VectorOfPairsUInt32Real32___len__", (PyCFunction)_wrap_VectorOfPairsUInt32Real32___len__, METH_O, (char *)"VectorOfPairsUInt32Real32___len__(self) -> std::vector< std::pair< unsigned int,float > >::size_type"},
	 { (char *)"VectorOfPairsUInt32Real32_pop", (PyCFunction)_wrap_VectorOfPairsUInt32Real32_pop, METH_O, (char *)"VectorOfPairsUInt32Real32_pop(self) -> PairUInt32Real32"},
	 { (char *)"VectorOfPairsUInt32Real32___getslice__", (PyCFunction) _wrap_VectorOfPairsUInt32Real32___getslice__, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfPairsUInt32Real32___getslice__(self, i, j) -> VectorOfPairsUInt32Real32"},
	 { (char *)"VectorOfPairsUInt32Real32___setslice__", (PyCFunction) _wrap_VectorOfPairsUInt32Real32___setslice__, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfPairsUInt32Real32___setslice__(self, i, j, v=std::vector< std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > >())"},
	 { (char *)"VectorOfPairsUInt32Real32___delslice__", (PyCFunction) _wrap_VectorOfPairsUInt32Real32___delslice__, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfPairsUInt32Real32___delslice__(self, i, j)"},
	 { (char *)"VectorOfPairsUInt32Real32___delitem__", _wrap_VectorOfPairsUInt32Real32___delitem__, METH_VARARGS, (char *)"\n"
		"__delitem__(i)\n"
		"VectorOfPairsUInt32Real32___delitem__(self, slice)\n"
		""},
	 { (char *)"VectorOfPairsUInt32Real32___getitem__", _wrap_VectorOfPairsUInt32Real32___getitem__, METH_VARARGS, (char *)"\n"
		"__getitem__(slice) -> VectorOfPairsUInt32Real32\n"
		"VectorOfPairsUInt32Real32___getitem__(self, i) -> PairUInt32Real32\n"
		""},
	 { (char *)"VectorOfPairsUInt32Real32___setitem__", _wrap_VectorOfPairsUInt32Real32___setitem__, METH_VARARGS, (char *)"\n"
		"__setitem__(slice, v)\n"
		"__setitem__(slice)\n"
		"VectorOfPairsUInt32Real32___setitem__(self, i, x)\n"
		""},
	 { (char *)"VectorOfPairsUInt32Real32_append", (PyCFunction) _wrap_VectorOfPairsUInt32Real32_append, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfPairsUInt32Real32_append(self, x)"},
	 { (char *)"VectorOfPairsUInt32Real32_empty", (PyCFunction)_wrap_VectorOfPairsUInt32Real32_empty, METH_O, (char *)"VectorOfPairsUInt32Real32_empty(self) -> bool"},
	 { (char *)"VectorOfPairsUInt32Real32_size", (PyCFunction)_wrap_VectorOfPairsUInt32Real32_size, METH_O, (char *)"VectorOfPairsUInt32Real32_size(self) -> std::vector< std::pair< unsigned int,float > >::size_type"},
	 { (char *)"VectorOfPairsUInt32Real32_clear", (PyCFunction)_wrap_VectorOfPairsUInt32Real32_clear, METH_O, (char *)"VectorOfPairsUInt32Real32_clear(self)"},
	 { (char *)"VectorOfPairsUInt32Real32_swap", (PyCFunction) _wrap_VectorOfPairsUInt32Real32_swap, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfPairsUInt32Real32_swap(self, v)"},
	 { (char *)"VectorOfPairsUInt32Real32_get_allocator", (PyCFunction)_wrap_VectorOfPairsUInt32Real32_get_allocator, METH_O, (char *)"VectorOfPairsUInt32Real32_get_allocator(self) -> std::vector< std::pair< unsigned int,float > >::allocator_type"},
	 { (char *)"VectorOfPairsUInt32Real32_begin", (PyCFunction)_wrap_VectorOfPairsUInt32Real32_begin, METH_O, (char *)"VectorOfPairsUInt32Real32_begin(self) -> std::vector< std::pair< unsigned int,float > >::iterator"},
	 { (char *)"VectorOfPairsUInt32Real32_end", (PyCFunction)_wrap_VectorOfPairsUInt32Real32_end, METH_O, (char *)"VectorOfPairsUInt32Real32_end(self) -> std::vector< std::pair< unsigned int,float > >::iterator"},
	 { (char *)"VectorOfPairsUInt32Real32_rbegin", (PyCFunction)_wrap_VectorOfPairsUInt32Real32_rbegin, METH_O, (char *)"VectorOfPairsUInt32Real32_rbegin(self) -> std::vector< std::pair< unsigned int,float > >::reverse_iterator"},
	 { (char *)"VectorOfPairsUInt32Real32_rend", (PyCFunction)_wrap_VectorOfPairsUInt32Real32_rend, METH_O, (char *)"VectorOfPairsUInt32Real32_rend(self) -> std::vector< std::pair< unsigned int,float > >::reverse_iterator"},
	 { (char *)"VectorOfPairsUInt32Real32_pop_back", (PyCFunction)_wrap_VectorOfPairsUInt32Real32_pop_back, METH_O, (char *)"VectorOfPairsUInt32Real32_pop_back(self)"},
	 { (char *)"VectorOfPairsUInt32Real32_erase", _wrap_VectorOfPairsUInt32Real32_erase, METH_VARARGS, (char *)"\n"
		"erase(pos) -> std::vector< std::pair< unsigned int,float > >::iterator\n"
		"VectorOfPairsUInt32Real32_erase(self, first, last) -> std::vector< std::pair< unsigned int,float > >::iterator\n"
		""},
	 { (char *)"new_VectorOfPairsUInt32Real32", _wrap_new_VectorOfPairsUInt32Real32, METH_VARARGS, (char *)"\n"
		"VectorOfPairsUInt32Real32()\n"
		"VectorOfPairsUInt32Real32(arg2)\n"
		"VectorOfPairsUInt32Real32(size)\n"
		"new_VectorOfPairsUInt32Real32(size, value) -> VectorOfPairsUInt32Real32\n"
		""},
	 { (char *)"VectorOfPairsUInt32Real32_push_back", (PyCFunction) _wrap_VectorOfPairsUInt32Real32_push_back, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfPairsUInt32Real32_push_back(self, x)"},
	 { (char *)"VectorOfPairsUInt32Real32_front", (PyCFunction)_wrap_VectorOfPairsUInt32Real32_front, METH_O, (char *)"VectorOfPairsUInt32Real32_front(self) -> PairUInt32Real32"},
	 { (char *)"VectorOfPairsUInt32Real32_back", (PyCFunction)_wrap_VectorOfPairsUInt32Real32_back, METH_O, (char *)"VectorOfPairsUInt32Real32_back(self) -> PairUInt32Real32"},
	 { (char *)"VectorOfPairsUInt32Real32_assign", (PyCFunction) _wrap_VectorOfPairsUInt32Real32_assign, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfPairsUInt32Real32_assign(self, n, x)"},
	 { (char *)"VectorOfPairsUInt32Real32_resize", _wrap_VectorOfPairsUInt32Real32_resize, METH_VARARGS, (char *)"\n"
		"resize(new_size)\n"
		"VectorOfPairsUInt32Real32_resize(self, new_size, x)\n"
		""},
	 { (char *)"VectorOfPairsUInt32Real32_insert", _wrap_VectorOfPairsUInt32Real32_insert, METH_VARARGS, (char *)"\n"
		"insert(pos, x) -> std::vector< std::pair< unsigned int,float > >::iterator\n"
		"VectorOfPairsUInt32Real32_insert(self, pos, n, x)\n"
		""},
	 { (char *)"VectorOfPairsUInt32Real32_reserve", (PyCFunction) _wrap_VectorOfPairsUInt32Real32_reserve, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfPairsUInt32Real32_reserve(self, n)"},
	 { (char *)"VectorOfPairsUInt32Real32_capacity", (PyCFunction)_wrap_VectorOfPairsUInt32Real32_capacity, METH_O, (char *)"VectorOfPairsUInt32Real32_capacity(self) -> std::vector< std::pair< unsigned int,float > >::size_type"},
	 { (char *)"delete_VectorOfPairsUInt32Real32", (PyCFunction)_wrap_delete_VectorOfPairsUInt32Real32, METH_O, (char *)"delete_VectorOfPairsUInt32Real32(self)"},
	 { (char *)"VectorOfPairsUInt32Real32_swigregister", VectorOfPairsUInt32Real32_swigregister, METH_VARARGS, NULL},
	 { (char *)"VectorOfPairsUInt32Real64_iterator", (PyCFunction)_wrap_VectorOfPairsUInt32Real64_iterator, METH_O, (char *)"VectorOfPairsUInt32Real64_iterator(self) -> SwigPyIterator"},
	 { (char *)"VectorOfPairsUInt32Real64___nonzero__", (PyCFunction)_wrap_VectorOfPairsUInt32Real64___nonzero__, METH_O, (char *)"VectorOfPairsUInt32Real64___nonzero__(self) -> bool"},
	 { (char *)"VectorOfPairsUInt32Real64___bool__", (PyCFunction)_wrap_VectorOfPairsUInt32Real64___bool__, METH_O, (char *)"VectorOfPairsUInt32Real64___bool__(self) -> bool"},
	 { (char *)"VectorOfPairsUInt32Real64___len__", (PyCFunction)_wrap_VectorOfPairsUInt32Real64___len__, METH_O, (char *)"VectorOfPairsUInt32Real64___len__(self) -> std::vector< std::pair< unsigned int,double > >::size_type"},
	 { (char *)"VectorOfPairsUInt32Real64_pop", (PyCFunction)_wrap_VectorOfPairsUInt32Real64_pop, METH_O, (char *)"VectorOfPairsUInt32Real64_pop(self) -> PairUInt32Real64"},
	 { (char *)"VectorOfPairsUInt32Real64___getslice__", (PyCFunction) _wrap_VectorOfPairsUInt32Real64___getslice__, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfPairsUInt32Real64___getslice__(self, i, j) -> VectorOfPairsUInt32Real64"},
	 { (char *)"VectorOfPairsUInt32Real64___setslice__", (PyCFunction) _wrap_VectorOfPairsUInt32Real64___setslice__, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfPairsUInt32Real64___setslice__(self, i, j, v=std::vector< std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > >())"},
	 { (char *)"VectorOfPairsUInt32Real64___delslice__", (PyCFunction) _wrap_VectorOfPairsUInt32Real64___delslice__, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfPairsUInt32Real64___delslice__(self, i, j)"},
	 { (char *)"VectorOfPairsUInt32Real64___delitem__", _wrap_VectorOfPairsUInt32Real64___delitem__, METH_VARARGS, (char *)"\n"
		"__delitem__(i)\n"
		"VectorOfPairsUInt32Real64___delitem__(self, slice)\n"
		""},
	 { (char *)"VectorOfPairsUInt32Real64___getitem__", _wrap_VectorOfPairsUInt32Real64___getitem__, METH_VARARGS, (char *)"\n"
		"__getitem__(slice) -> VectorOfPairsUInt32Real64\n"
		"VectorOfPairsUInt32Real64___getitem__(self, i) -> PairUInt32Real64\n"
		""},
	 { (char *)"VectorOfPairsUInt32Real64___setitem__", _wrap_VectorOfPairsUInt32Real64___setitem__, METH_VARARGS, (char *)"\n"
		"__setitem__(slice, v)\n"
		"__setitem__(slice)\n"
		"VectorOfPairsUInt32Real64___setitem__(self, i, x)\n"
		""},
	 { (char *)"VectorOfPairsUInt32Real64_append", (PyCFunction) _wrap_VectorOfPairsUInt32Real64_append, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfPairsUInt32Real64_append(self, x)"},
	 { (char *)"VectorOfPairsUInt32Real64_empty", (PyCFunction)_wrap_VectorOfPairsUInt32Real64_empty, METH_O, (char *)"VectorOfPairsUInt32Real64_empty(self) -> bool"},
	 { (char *)"VectorOfPairsUInt32Real64_size", (PyCFunction)_wrap_VectorOfPairsUInt32Real64_size, METH_O, (char *)"VectorOfPairsUInt32Real64_size(self) -> std::vector< std::pair< unsigned int,double > >::size_type"},
	 { (char *)"VectorOfPairsUInt32Real64_clear", (PyCFunction)_wrap_VectorOfPairsUInt32Real64_clear, METH_O, (char *)"VectorOfPairsUInt32Real64_clear(self)"},
	 { (char *)"VectorOfPairsUInt32Real64_swap", (PyCFunction) _wrap_VectorOfPairsUInt32Real64_swap, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfPairsUInt32Real64_swap(self, v)"},
	 { (char *)"VectorOfPairsUInt32Real64_get_allocator", (PyCFunction)_wrap_VectorOfPairsUInt32Real64_get_allocator, METH_O, (char *)"VectorOfPairsUInt32Real64_get_allocator(self) -> std::vector< std::pair< unsigned int,double > >::allocator_type"},
	 { (char *)"VectorOfPairsUInt32Real64_begin", (PyCFunction)_wrap_VectorOfPairsUInt32Real64_begin, METH_O, (char *)"VectorOfPairsUInt32Real64_begin(self) -> std::vector< std::pair< unsigned int,double > >::iterator"},
	 { (char *)"VectorOfPairsUInt32Real64_end", (PyCFunction)_wrap_VectorOfPairsUInt32Real64_end, METH_O, (char *)"VectorOfPairsUInt32Real64_end(self) -> std::vector< std::pair< unsigned int,double > >::iterator"},
	 { (char *)"VectorOfPairsUInt32Real64_rbegin", (PyCFunction)_wrap_VectorOfPairsUInt32Real64_rbegin, METH_O, (char *)"VectorOfPairsUInt32Real64_rbegin(self) -> std::vector< std::pair< unsigned int,double > >::reverse_iterator"},
	 { (char *)"VectorOfPairsUInt32Real64_rend", (PyCFunction)_wrap_VectorOfPairsUInt32Real64_rend, METH_O, (char *)"VectorOfPairsUInt32Real64_rend(self) -> std::vector< std::pair< unsigned int,double > >::reverse_iterator"},
	 { (char *)"VectorOfPairsUInt32Real64_pop_back", (PyCFunction)_wrap_VectorOfPairsUInt32Real64_pop_back, METH_O, (char *)"VectorOfPairsUInt32Real64_pop_back(self)"},
	 { (char *)"VectorOfPairsUInt32Real64_erase", _wrap_VectorOfPairsUInt32Real64_erase, METH_VARARGS, (char *)"\n"
		"erase(pos) -> std::vector< std::pair< unsigned int,double > >::iterator\n"
		"VectorOfPairsUInt32Real64_erase(self, first, last) -> std::vector< std::pair< unsigned int,double > >::iterator\n"
		""},
	 { (char *)"new_VectorOfPairsUInt32Real64", _wrap_new_VectorOfPairsUInt32Real64, METH_VARARGS, (char *)"\n"
		"VectorOfPairsUInt32Real64()\n"
		"VectorOfPairsUInt32Real64(arg2)\n"
		"VectorOfPairsUInt32Real64(size)\n"
		"new_VectorOfPairsUInt32Real64(size, value) -> VectorOfPairsUInt32Real64\n"
		""},
	 { (char *)"VectorOfPairsUInt32Real64_push_back", (PyCFunction) _wrap_VectorOfPairsUInt32Real64_push_back, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfPairsUInt32Real64_push_back(self, x)"},
	 { (char *)"VectorOfPairsUInt32Real64_front", (PyCFunction)_wrap_VectorOfPairsUInt32Real64_front, METH_O, (char *)"VectorOfPairsUInt32Real64_front(self) -> PairUInt32Real64"},
	 { (char *)"VectorOfPairsUInt32Real64_back", (PyCFunction)_wrap_VectorOfPairsUInt32Real64_back, METH_O, (char *)"VectorOfPairsUInt32Real64_back(self) -> PairUInt32Real64"},
	 { (char *)"VectorOfPairsUInt32Real64_assign", (PyCFunction) _wrap_VectorOfPairsUInt32Real64_assign, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfPairsUInt32Real64_assign(self, n, x)"},
	 { (char *)"VectorOfPairsUInt32Real64_resize", _wrap_VectorOfPairsUInt32Real64_resize, METH_VARARGS, (char *)"\n"
		"resize(new_size)\n"
		"VectorOfPairsUInt32Real64_resize(self, new_size, x)\n"
		""},
	 { (char *)"VectorOfPairsUInt32Real64_insert", _wrap_VectorOfPairsUInt32Real64_insert, METH_VARARGS, (char *)"\n"
		"insert(pos, x) -> std::vector< std::pair< unsigned int,double > >::iterator\n"
		"VectorOfPairsUInt32Real64_insert(self, pos, n, x)\n"
		""},
	 { (char *)"VectorOfPairsUInt32Real64_reserve", (PyCFunction) _wrap_VectorOfPairsUInt32Real64_reserve, METH_VARARGS | METH_KEYWORDS, (char *)"VectorOfPairsUInt32Real64_reserve(self, n)"},
	 { (char *)"VectorOfPairsUInt32Real64_capacity", (PyCFunction)_wrap_VectorOfPairsUInt32Real64_capacity, METH_O, (char *)"VectorOfPairsUInt32Real64_capacity(self) -> std::vector< std::pair< unsigned int,double > >::size_type"},
	 { (char *)"delete_VectorOfPairsUInt32Real64", (PyCFunction)_wrap_delete_VectorOfPairsUInt32Real64, METH_O, (char *)"delete_VectorOfPairsUInt32Real64(self)"},
	 { (char *)"VectorOfPairsUInt32Real64_swigregister", VectorOfPairsUInt32Real64_swigregister, METH_VARARGS, NULL},
	 { (char *)"GetBasicTypeFromName", (PyCFunction) _wrap_GetBasicTypeFromName, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
		"GetBasicTypeFromName(type) -> NTA_BasicType\n"
		"\n"
		"GetBasicTypeFromName(typeName) -> int\n"
		"\n"
		"Internal use.\n"
		"Finds a base type enumeration given a type name.\n"
		"\n"
		""},
	 { (char *)"GetBasicTypeSize", (PyCFunction) _wrap_GetBasicTypeSize, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
		"GetBasicTypeSize(type) -> size_t\n"
		"\n"
		"GetBasicTypeFromName(typeName) -> int\n"
		"\n"
		"Internal use.\n"
		"Gets the number of bytes use to specify the named\n"
		"type in C code.\n"
		"\n"
		""},
	 { (char *)"getGlobalEpsilon", (PyCFunction)_wrap_getGlobalEpsilon, METH_NOARGS, (char *)"getGlobalEpsilon() -> nupic::Real"},
	 { (char *)"INVARIANT", (PyCFunction) _wrap_INVARIANT, METH_VARARGS | METH_KEYWORDS, (char *)"INVARIANT(cond, msg) -> bool"},
	 { (char *)"emod", (PyCFunction) _wrap_emod, METH_VARARGS | METH_KEYWORDS, (char *)"emod(x, m) -> int"},
	 { (char *)"new_SparseMatrixAlgorithms", (PyCFunction)_wrap_new_SparseMatrixAlgorithms, METH_NOARGS, (char *)"new_SparseMatrixAlgorithms() -> SparseMatrixAlgorithms"},
	 { (char *)"delete_SparseMatrixAlgorithms", (PyCFunction)_wrap_delete_SparseMatrixAlgorithms, METH_O, (char *)"delete_SparseMatrixAlgorithms(self)"},
	 { (char *)"SparseMatrixAlgorithms_swigregister", SparseMatrixAlgorithms_swigregister, METH_VARARGS, NULL},
	 { (char *)"new_LogSumApprox", (PyCFunction) _wrap_new_LogSumApprox, METH_VARARGS | METH_KEYWORDS, (char *)"new_LogSumApprox(n_=5000000, min_a_=-28, max_a_=28, trace_=False) -> LogSumApprox"},
	 { (char *)"LogSumApprox_compute_table", (PyCFunction)_wrap_LogSumApprox_compute_table, METH_O, (char *)"LogSumApprox_compute_table(self)"},
	 { (char *)"LogSumApprox_index", (PyCFunction) _wrap_LogSumApprox_index, METH_VARARGS | METH_KEYWORDS, (char *)"LogSumApprox_index(self, a, b) -> int"},
	 { (char *)"LogSumApprox_fast_sum_of_logs", (PyCFunction) _wrap_LogSumApprox_fast_sum_of_logs, METH_VARARGS | METH_KEYWORDS, (char *)"LogSumApprox_fast_sum_of_logs(self, a, b) -> nupic::LogSumApprox::value_type"},
	 { (char *)"LogSumApprox_sum_of_logs", (PyCFunction) _wrap_LogSumApprox_sum_of_logs, METH_VARARGS | METH_KEYWORDS, (char *)"LogSumApprox_sum_of_logs(self, a, b) -> nupic::LogSumApprox::value_type"},
	 { (char *)"LogSumApprox_logSum", (PyCFunction) _wrap_LogSumApprox_logSum, METH_VARARGS | METH_KEYWORDS, (char *)"LogSumApprox_logSum(self, x, y) -> nupic::Real32"},
	 { (char *)"LogSumApprox_fastLogSum", (PyCFunction) _wrap_LogSumApprox_fastLogSum, METH_VARARGS | METH_KEYWORDS, (char *)"LogSumApprox_fastLogSum(self, x, y) -> nupic::Real32"},
	 { (char *)"delete_LogSumApprox", (PyCFunction)_wrap_delete_LogSumApprox, METH_O, (char *)"delete_LogSumApprox(self)"},
	 { (char *)"LogSumApprox_swigregister", LogSumApprox_swigregister, METH_VARARGS, NULL},
	 { (char *)"new_LogDiffApprox", (PyCFunction) _wrap_new_LogDiffApprox, METH_VARARGS | METH_KEYWORDS, (char *)"new_LogDiffApprox(n_=5000000, min_a_=1e-10, max_a_=28, trace_=False) -> LogDiffApprox"},
	 { (char *)"LogDiffApprox_compute_table", (PyCFunction)_wrap_LogDiffApprox_compute_table, METH_O, (char *)"LogDiffApprox_compute_table(self)"},
	 { (char *)"LogDiffApprox_index", (PyCFunction) _wrap_LogDiffApprox_index, METH_VARARGS | METH_KEYWORDS, (char *)"LogDiffApprox_index(self, a, b) -> int"},
	 { (char *)"LogDiffApprox_fast_diff_of_logs", (PyCFunction) _wrap_LogDiffApprox_fast_diff_of_logs, METH_VARARGS | METH_KEYWORDS, (char *)"LogDiffApprox_fast_diff_of_logs(self, a, b) -> nupic::LogDiffApprox::value_type"},
	 { (char *)"LogDiffApprox_diff_of_logs", (PyCFunction) _wrap_LogDiffApprox_diff_of_logs, METH_VARARGS | METH_KEYWORDS, (char *)"LogDiffApprox_diff_of_logs(self, a, b) -> nupic::LogDiffApprox::value_type"},
	 { (char *)"LogDiffApprox_logDiff", (PyCFunction) _wrap_LogDiffApprox_logDiff, METH_VARARGS | METH_KEYWORDS, (char *)"LogDiffApprox_logDiff(self, x, y) -> nupic::Real32"},
	 { (char *)"LogDiffApprox_fastLogDiff", (PyCFunction) _wrap_LogDiffApprox_fastLogDiff, METH_VARARGS | METH_KEYWORDS, (char *)"LogDiffApprox_fastLogDiff(self, x, y) -> nupic::Real32"},
	 { (char *)"delete_LogDiffApprox", (PyCFunction)_wrap_delete_LogDiffApprox, METH_O, (char *)"delete_LogDiffApprox(self)"},
	 { (char *)"LogDiffApprox_swigregister", LogDiffApprox_swigregister, METH_VARARGS, NULL},
	 { (char *)"new__Domain32", (PyCFunction) _wrap_new__Domain32, METH_VARARGS | METH_KEYWORDS, (char *)"new__Domain32(o) -> _Domain32"},
	 { (char *)"_Domain32_rank", (PyCFunction)_wrap__Domain32_rank, METH_O, (char *)"_Domain32_rank(self) -> unsigned int"},
	 { (char *)"_Domain32_empty", (PyCFunction)_wrap__Domain32_empty, METH_O, (char *)"_Domain32_empty(self) -> bool"},
	 { (char *)"_Domain32_size_elts", (PyCFunction)_wrap__Domain32_size_elts, METH_O, (char *)"_Domain32_size_elts(self) -> unsigned int"},
	 { (char *)"_Domain32_getNOpenDims", (PyCFunction)_wrap__Domain32_getNOpenDims, METH_O, (char *)"_Domain32_getNOpenDims(self) -> unsigned int"},
	 { (char *)"_Domain32_hasClosedDims", (PyCFunction)_wrap__Domain32_hasClosedDims, METH_O, (char *)"_Domain32_hasClosedDims(self) -> bool"},
	 { (char *)"_Domain32_getNClosedDims", (PyCFunction)_wrap__Domain32_getNClosedDims, METH_O, (char *)"_Domain32_getNClosedDims(self) -> unsigned int"},
	 { (char *)"_Domain32_includes", (PyCFunction) _wrap__Domain32_includes, METH_VARARGS | METH_KEYWORDS, (char *)"_Domain32_includes(self, d) -> bool"},
	 { (char *)"delete__Domain32", (PyCFunction)_wrap_delete__Domain32, METH_O, (char *)"delete__Domain32(self)"},
	 { (char *)"_Domain32_swigregister", _Domain32_swigregister, METH_VARARGS, NULL},
	 { (char *)"new__Domain2D32", (PyCFunction) _wrap_new__Domain2D32, METH_VARARGS | METH_KEYWORDS, (char *)"new__Domain2D32(first_row, row_end, first_col, col_end) -> _Domain2D32"},
	 { (char *)"_Domain2D32_getFirstRow", (PyCFunction)_wrap__Domain2D32_getFirstRow, METH_O, (char *)"_Domain2D32_getFirstRow(self) -> unsigned int"},
	 { (char *)"_Domain2D32_getRowEnd", (PyCFunction)_wrap__Domain2D32_getRowEnd, METH_O, (char *)"_Domain2D32_getRowEnd(self) -> unsigned int"},
	 { (char *)"_Domain2D32_getFirstCol", (PyCFunction)_wrap__Domain2D32_getFirstCol, METH_O, (char *)"_Domain2D32_getFirstCol(self) -> unsigned int"},
	 { (char *)"_Domain2D32_getColEnd", (PyCFunction)_wrap__Domain2D32_getColEnd, METH_O, (char *)"_Domain2D32_getColEnd(self) -> unsigned int"},
	 { (char *)"delete__Domain2D32", (PyCFunction)_wrap_delete__Domain2D32, METH_O, (char *)"delete__Domain2D32(self)"},
	 { (char *)"_Domain2D32_swigregister", _Domain2D32_swigregister, METH_VARARGS, NULL},
	 { (char *)"_DistanceToZero32___call__", (PyCFunction) _wrap__DistanceToZero32___call__, METH_VARARGS | METH_KEYWORDS, (char *)"_DistanceToZero32___call__(self, x) -> float"},
	 { (char *)"new__DistanceToZero32", (PyCFunction)_wrap_new__DistanceToZero32, METH_NOARGS, (char *)"new__DistanceToZero32() -> _DistanceToZero32"},
	 { (char *)"delete__DistanceToZero32", (PyCFunction)_wrap_delete__DistanceToZero32, METH_O, (char *)"delete__DistanceToZero32(self)"},
	 { (char *)"_DistanceToZero32_swigregister", _DistanceToZero32_swigregister, METH_VARARGS, NULL},
	 { (char *)"new__SparseMatrix32", _wrap_new__SparseMatrix32, METH_VARARGS, (char *)"\n"
		"_SparseMatrix32()\n"
		"_SparseMatrix32(nrows, ncols)\n"
		"_SparseMatrix32(inStream)\n"
		"new__SparseMatrix32(other) -> _SparseMatrix32\n"
		""},
	 { (char *)"_SparseMatrix32_initializeWithFixedNNZR", (PyCFunction) _wrap__SparseMatrix32_initializeWithFixedNNZR, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_initializeWithFixedNNZR(self, nnzr, v=1, mode=0, seed=42)"},
	 { (char *)"delete__SparseMatrix32", (PyCFunction)_wrap_delete__SparseMatrix32, METH_O, (char *)"delete__SparseMatrix32(self)"},
	 { (char *)"_SparseMatrix32_isZero", (PyCFunction)_wrap__SparseMatrix32_isZero, METH_O, (char *)"_SparseMatrix32_isZero(self) -> bool"},
	 { (char *)"_SparseMatrix32_getIsNearlyZeroFunction", (PyCFunction)_wrap__SparseMatrix32_getIsNearlyZeroFunction, METH_O, (char *)"_SparseMatrix32_getIsNearlyZeroFunction(self) -> nupic::IsNearlyZero< nupic::DistanceToZero< nupic::Real32 > > const &"},
	 { (char *)"_SparseMatrix32_isCompact", (PyCFunction)_wrap__SparseMatrix32_isCompact, METH_O, (char *)"_SparseMatrix32_isCompact(self) -> bool"},
	 { (char *)"_SparseMatrix32_nRows", (PyCFunction)_wrap__SparseMatrix32_nRows, METH_O, (char *)"_SparseMatrix32_nRows(self) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type"},
	 { (char *)"_SparseMatrix32_nCols", (PyCFunction)_wrap__SparseMatrix32_nCols, METH_O, (char *)"_SparseMatrix32_nCols(self) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type"},
	 { (char *)"_SparseMatrix32_nBytes", (PyCFunction)_wrap__SparseMatrix32_nBytes, METH_O, (char *)"_SparseMatrix32_nBytes(self) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type"},
	 { (char *)"_SparseMatrix32_nNonZerosOnRow", (PyCFunction) _wrap__SparseMatrix32_nNonZerosOnRow, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_nNonZerosOnRow(self, row) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type"},
	 { (char *)"_SparseMatrix32_nNonZerosOnCol", (PyCFunction) _wrap__SparseMatrix32_nNonZerosOnCol, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_nNonZerosOnCol(self, col) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type"},
	 { (char *)"_SparseMatrix32_nNonZeros", (PyCFunction)_wrap__SparseMatrix32_nNonZeros, METH_O, (char *)"_SparseMatrix32_nNonZeros(self) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type"},
	 { (char *)"_SparseMatrix32_isRowZero", (PyCFunction) _wrap__SparseMatrix32_isRowZero, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_isRowZero(self, row) -> bool"},
	 { (char *)"_SparseMatrix32_isColZero", (PyCFunction) _wrap__SparseMatrix32_isColZero, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_isColZero(self, col) -> bool"},
	 { (char *)"_SparseMatrix32_nNonZeroRows", (PyCFunction)_wrap__SparseMatrix32_nNonZeroRows, METH_O, (char *)"_SparseMatrix32_nNonZeroRows(self) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type"},
	 { (char *)"_SparseMatrix32_nNonZeroCols", (PyCFunction)_wrap__SparseMatrix32_nNonZeroCols, METH_O, (char *)"_SparseMatrix32_nNonZeroCols(self) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type"},
	 { (char *)"_SparseMatrix32_nZeroRows", (PyCFunction)_wrap__SparseMatrix32_nZeroRows, METH_O, (char *)"_SparseMatrix32_nZeroRows(self) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type"},
	 { (char *)"_SparseMatrix32_nZeroCols", (PyCFunction)_wrap__SparseMatrix32_nZeroCols, METH_O, (char *)"_SparseMatrix32_nZeroCols(self) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type"},
	 { (char *)"_SparseMatrix32_firstNonZeroOnRow", (PyCFunction) _wrap__SparseMatrix32_firstNonZeroOnRow, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_firstNonZeroOnRow(self, row) -> PairUInt32Real32"},
	 { (char *)"_SparseMatrix32_lastNonZeroOnRow", (PyCFunction) _wrap__SparseMatrix32_lastNonZeroOnRow, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_lastNonZeroOnRow(self, row) -> PairUInt32Real32"},
	 { (char *)"_SparseMatrix32_rowBandwidth", (PyCFunction) _wrap__SparseMatrix32_rowBandwidth, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_rowBandwidth(self, row) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type"},
	 { (char *)"_SparseMatrix32_firstNonZeroOnCol", (PyCFunction) _wrap__SparseMatrix32_firstNonZeroOnCol, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_firstNonZeroOnCol(self, col) -> PairUInt32Real32"},
	 { (char *)"_SparseMatrix32_lastNonZeroOnCol", (PyCFunction) _wrap__SparseMatrix32_lastNonZeroOnCol, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_lastNonZeroOnCol(self, col) -> PairUInt32Real32"},
	 { (char *)"_SparseMatrix32_colBandwidth", (PyCFunction) _wrap__SparseMatrix32_colBandwidth, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_colBandwidth(self, col) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type"},
	 { (char *)"_SparseMatrix32_nonZerosInRowRange", (PyCFunction) _wrap__SparseMatrix32_nonZerosInRowRange, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_nonZerosInRowRange(self, row, col_begin, col_end) -> bool"},
	 { (char *)"_SparseMatrix32_nNonZerosInRowRange", (PyCFunction) _wrap__SparseMatrix32_nNonZerosInRowRange, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_nNonZerosInRowRange(self, row, col_begin, col_end) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type"},
	 { (char *)"_SparseMatrix32_nNonZerosInBox", (PyCFunction) _wrap__SparseMatrix32_nNonZerosInBox, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_nNonZerosInBox(self, row_begin, row_end, col_begin, col_end) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type"},
	 { (char *)"_SparseMatrix32_isSymmetric", (PyCFunction)_wrap__SparseMatrix32_isSymmetric, METH_O, (char *)"_SparseMatrix32_isSymmetric(self) -> bool"},
	 { (char *)"_SparseMatrix32_isBinary", (PyCFunction)_wrap__SparseMatrix32_isBinary, METH_O, (char *)"_SparseMatrix32_isBinary(self) -> bool"},
	 { (char *)"_SparseMatrix32_equals", (PyCFunction) _wrap__SparseMatrix32_equals, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_equals(self, B) -> bool"},
	 { (char *)"_SparseMatrix32_sameRowNonZeroIndices", (PyCFunction) _wrap__SparseMatrix32_sameRowNonZeroIndices, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_sameRowNonZeroIndices(self, row, B) -> bool"},
	 { (char *)"_SparseMatrix32_sameNonZeroIndices", (PyCFunction) _wrap__SparseMatrix32_sameNonZeroIndices, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_sameNonZeroIndices(self, B) -> bool"},
	 { (char *)"_SparseMatrix32_nonZeroIndicesIncluded", _wrap__SparseMatrix32_nonZeroIndicesIncluded, METH_VARARGS, (char *)"\n"
		"nonZeroIndicesIncluded(row, B) -> bool\n"
		"_SparseMatrix32_nonZeroIndicesIncluded(self, B) -> bool\n"
		""},
	 { (char *)"_SparseMatrix32_compact", (PyCFunction)_wrap__SparseMatrix32_compact, METH_O, (char *)"_SparseMatrix32_compact(self)"},
	 { (char *)"_SparseMatrix32_decompact", (PyCFunction)_wrap__SparseMatrix32_decompact, METH_O, (char *)"_SparseMatrix32_decompact(self)"},
	 { (char *)"_SparseMatrix32_CSRSize", (PyCFunction)_wrap__SparseMatrix32_CSRSize, METH_O, (char *)"_SparseMatrix32_CSRSize(self) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type"},
	 { (char *)"_SparseMatrix32_fromCSR", (PyCFunction) _wrap__SparseMatrix32_fromCSR, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_fromCSR(self, inStreamParam, zero_permissive=False) -> std::istream &"},
	 { (char *)"_SparseMatrix32_toCSR", (PyCFunction) _wrap__SparseMatrix32_toCSR, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_toCSR(self, out) -> std::ostream &"},
	 { (char *)"_SparseMatrix32_fromBinary", (PyCFunction) _wrap__SparseMatrix32_fromBinary, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_fromBinary(self, inStream)"},
	 { (char *)"_SparseMatrix32_toBinary", (PyCFunction) _wrap__SparseMatrix32_toBinary, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_toBinary(self, outStream)"},
	 { (char *)"_SparseMatrix32_resize", (PyCFunction) _wrap__SparseMatrix32_resize, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_resize(self, new_nrows, new_ncols, setToZero=False)"},
	 { (char *)"_SparseMatrix32_reshape", (PyCFunction) _wrap__SparseMatrix32_reshape, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_reshape(self, new_nrows, new_ncols)"},
	 { (char *)"_SparseMatrix32_deleteRow", (PyCFunction) _wrap__SparseMatrix32_deleteRow, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_deleteRow(self, del_row)"},
	 { (char *)"_SparseMatrix32_deleteCol", (PyCFunction) _wrap__SparseMatrix32_deleteCol, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_deleteCol(self, del_col)"},
	 { (char *)"_SparseMatrix32_append", (PyCFunction) _wrap__SparseMatrix32_append, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_append(self, other, zero_permissive=False)"},
	 { (char *)"_SparseMatrix32_duplicateRow", (PyCFunction) _wrap__SparseMatrix32_duplicateRow, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_duplicateRow(self, row)"},
	 { (char *)"_SparseMatrix32_setZero", (PyCFunction) _wrap__SparseMatrix32_setZero, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_setZero(self, row, col, resizeYesNo=False)"},
	 { (char *)"_SparseMatrix32_setDiagonalToZero", (PyCFunction)_wrap__SparseMatrix32_setDiagonalToZero, METH_O, (char *)"_SparseMatrix32_setDiagonalToZero(self)"},
	 { (char *)"_SparseMatrix32_setDiagonalToVal", (PyCFunction) _wrap__SparseMatrix32_setDiagonalToVal, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_setDiagonalToVal(self, val)"},
	 { (char *)"_SparseMatrix32_setNonZero", (PyCFunction) _wrap__SparseMatrix32_setNonZero, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_setNonZero(self, i, j, val, resizeYesNo=False)"},
	 { (char *)"_SparseMatrix32_set", (PyCFunction) _wrap__SparseMatrix32_set, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_set(self, i, j, val, resizeYesNo=False)"},
	 { (char *)"_SparseMatrix32_setBoxToZero", (PyCFunction) _wrap__SparseMatrix32_setBoxToZero, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_setBoxToZero(self, row_begin, row_end, col_begin, col_end)"},
	 { (char *)"_SparseMatrix32_setBox", (PyCFunction) _wrap__SparseMatrix32_setBox, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_setBox(self, row_begin, row_end, col_begin, col_end, val)"},
	 { (char *)"_SparseMatrix32_increment", (PyCFunction) _wrap__SparseMatrix32_increment, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_increment(self, i, j, delta=1, resizeYesNo=False)"},
	 { (char *)"_SparseMatrix32_incrementWNZ", (PyCFunction) _wrap__SparseMatrix32_incrementWNZ, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_incrementWNZ(self, i, j, delta=1, resizeYesNo=False)"},
	 { (char *)"_SparseMatrix32_get", (PyCFunction) _wrap__SparseMatrix32_get, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_get(self, row, col) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type"},
	 { (char *)"_SparseMatrix32_row_nz_index_begin", (PyCFunction) _wrap__SparseMatrix32_row_nz_index_begin, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_row_nz_index_begin(self, row) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::const_row_nz_index_iterator"},
	 { (char *)"_SparseMatrix32_row_nz_index_end", (PyCFunction) _wrap__SparseMatrix32_row_nz_index_end, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_row_nz_index_end(self, row) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::const_row_nz_index_iterator"},
	 { (char *)"_SparseMatrix32_row_nz_value_begin", (PyCFunction) _wrap__SparseMatrix32_row_nz_value_begin, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_row_nz_value_begin(self, row) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::const_row_nz_value_iterator"},
	 { (char *)"_SparseMatrix32_row_nz_value_end", (PyCFunction) _wrap__SparseMatrix32_row_nz_value_end, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_row_nz_value_end(self, row) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::const_row_nz_value_iterator"},
	 { (char *)"_SparseMatrix32_setRowToZero", (PyCFunction) _wrap__SparseMatrix32_setRowToZero, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_setRowToZero(self, row)"},
	 { (char *)"_SparseMatrix32_setRowToVal", (PyCFunction) _wrap__SparseMatrix32_setRowToVal, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_setRowToVal(self, row, val)"},
	 { (char *)"_SparseMatrix32_setColToZero", (PyCFunction) _wrap__SparseMatrix32_setColToZero, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_setColToZero(self, col)"},
	 { (char *)"_SparseMatrix32_setColToVal", (PyCFunction) _wrap__SparseMatrix32_setColToVal, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_setColToVal(self, col, val)"},
	 { (char *)"_SparseMatrix32_setToZero", (PyCFunction)_wrap__SparseMatrix32_setToZero, METH_O, (char *)"_SparseMatrix32_setToZero(self)"},
	 { (char *)"_SparseMatrix32_setFromOuter", (PyCFunction) _wrap__SparseMatrix32_setFromOuter, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_setFromOuter(self, x, y, keepMemory=False)"},
	 { (char *)"_SparseMatrix32_setFromElementMultiplyWithOuter", (PyCFunction) _wrap__SparseMatrix32_setFromElementMultiplyWithOuter, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_setFromElementMultiplyWithOuter(self, x, y, b)"},
	 { (char *)"_SparseMatrix32_setRowFromDense", (PyCFunction) _wrap__SparseMatrix32_setRowFromDense, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_setRowFromDense(self, row, x)"},
	 { (char *)"_SparseMatrix32_getRowToDense", (PyCFunction) _wrap__SparseMatrix32_getRowToDense, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_getRowToDense(self, row, dense)"},
	 { (char *)"_SparseMatrix32_copyRow", (PyCFunction) _wrap__SparseMatrix32_copyRow, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_copyRow(self, dst_row, src_row, other)"},
	 { (char *)"_SparseMatrix32_getColToDense", (PyCFunction) _wrap__SparseMatrix32_getColToDense, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_getColToDense(self, col, dense)"},
	 { (char *)"_SparseMatrix32_setColFromDense", (PyCFunction) _wrap__SparseMatrix32_setColFromDense, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_setColFromDense(self, col, x)"},
	 { (char *)"_SparseMatrix32_shiftRows", (PyCFunction) _wrap__SparseMatrix32_shiftRows, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_shiftRows(self, n)"},
	 { (char *)"_SparseMatrix32_shiftCols", (PyCFunction) _wrap__SparseMatrix32_shiftCols, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_shiftCols(self, n)"},
	 { (char *)"_SparseMatrix32_transpose", _wrap__SparseMatrix32_transpose, METH_VARARGS, (char *)"\n"
		"transpose(tr)\n"
		"_SparseMatrix32_transpose(self)\n"
		""},
	 { (char *)"_SparseMatrix32_addToTranspose", _wrap__SparseMatrix32_addToTranspose, METH_VARARGS, (char *)"\n"
		"addToTranspose(sm)\n"
		"_SparseMatrix32_addToTranspose(self)\n"
		""},
	 { (char *)"_SparseMatrix32_thresholdRow", (PyCFunction) _wrap__SparseMatrix32_thresholdRow, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_thresholdRow(self, row, threshold=Epsilon)"},
	 { (char *)"_SparseMatrix32_thresholdCol", (PyCFunction) _wrap__SparseMatrix32_thresholdCol, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_thresholdCol(self, col, threshold=Epsilon)"},
	 { (char *)"_SparseMatrix32_clipRow", (PyCFunction) _wrap__SparseMatrix32_clipRow, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_clipRow(self, row, val, above=True)"},
	 { (char *)"_SparseMatrix32_clipRowAboveAndBelow", (PyCFunction) _wrap__SparseMatrix32_clipRowAboveAndBelow, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_clipRowAboveAndBelow(self, row, a, b)"},
	 { (char *)"_SparseMatrix32_clipCol", (PyCFunction) _wrap__SparseMatrix32_clipCol, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_clipCol(self, col, val, above=True)"},
	 { (char *)"_SparseMatrix32_clipColAboveAndBelow", (PyCFunction) _wrap__SparseMatrix32_clipColAboveAndBelow, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_clipColAboveAndBelow(self, col, a, b)"},
	 { (char *)"_SparseMatrix32_clip", (PyCFunction) _wrap__SparseMatrix32_clip, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_clip(self, val, above=True)"},
	 { (char *)"_SparseMatrix32_clipAboveAndBelow", (PyCFunction) _wrap__SparseMatrix32_clipAboveAndBelow, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_clipAboveAndBelow(self, a, b)"},
	 { (char *)"_SparseMatrix32_countWhereEqual", (PyCFunction) _wrap__SparseMatrix32_countWhereEqual, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_countWhereEqual(self, begin_row, end_row, begin_col, end_col, value) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type"},
	 { (char *)"_SparseMatrix32_countWhereGreater", (PyCFunction) _wrap__SparseMatrix32_countWhereGreater, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_countWhereGreater(self, begin_row, end_row, begin_col, end_col, value) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type"},
	 { (char *)"_SparseMatrix32_countWhereGreaterEqual", (PyCFunction) _wrap__SparseMatrix32_countWhereGreaterEqual, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_countWhereGreaterEqual(self, begin_row, end_row, begin_col, end_col, value) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type"},
	 { (char *)"_SparseMatrix32_argmax", (PyCFunction)_wrap__SparseMatrix32_argmax, METH_O, (char *)"_SparseMatrix32_argmax(self) -> PairOfUInt32"},
	 { (char *)"_SparseMatrix32_argmin", (PyCFunction)_wrap__SparseMatrix32_argmin, METH_O, (char *)"_SparseMatrix32_argmin(self) -> PairOfUInt32"},
	 { (char *)"_SparseMatrix32_normalizeRow", (PyCFunction) _wrap__SparseMatrix32_normalizeRow, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_normalizeRow(self, row, val=1.0, exact=False) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type"},
	 { (char *)"_SparseMatrix32_normalizeCol", (PyCFunction) _wrap__SparseMatrix32_normalizeCol, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_normalizeCol(self, col, val=1.0, exact=False) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type"},
	 { (char *)"_SparseMatrix32_normalizeRows", (PyCFunction) _wrap__SparseMatrix32_normalizeRows, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_normalizeRows(self, val=1.0, exact=False)"},
	 { (char *)"_SparseMatrix32_normalizeCols", (PyCFunction) _wrap__SparseMatrix32_normalizeCols, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_normalizeCols(self, val=1.0, exact=False)"},
	 { (char *)"_SparseMatrix32_normalize", (PyCFunction) _wrap__SparseMatrix32_normalize, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_normalize(self, val=1.0, exact=False)"},
	 { (char *)"_SparseMatrix32_normalize_max", (PyCFunction) _wrap__SparseMatrix32_normalize_max, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_normalize_max(self, val=1.0)"},
	 { (char *)"_SparseMatrix32_rowSum", (PyCFunction) _wrap__SparseMatrix32_rowSum, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_rowSum(self, row) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type"},
	 { (char *)"_SparseMatrix32_rowProd", (PyCFunction) _wrap__SparseMatrix32_rowProd, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_rowProd(self, row) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type"},
	 { (char *)"_SparseMatrix32_colSum", (PyCFunction) _wrap__SparseMatrix32_colSum, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_colSum(self, col) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type"},
	 { (char *)"_SparseMatrix32_colProd", (PyCFunction) _wrap__SparseMatrix32_colProd, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_colProd(self, col) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type"},
	 { (char *)"_SparseMatrix32_sum", (PyCFunction)_wrap__SparseMatrix32_sum, METH_O, (char *)"_SparseMatrix32_sum(self) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type"},
	 { (char *)"_SparseMatrix32_prod", (PyCFunction)_wrap__SparseMatrix32_prod, METH_O, (char *)"_SparseMatrix32_prod(self) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type"},
	 { (char *)"_SparseMatrix32_lerp", (PyCFunction) _wrap__SparseMatrix32_lerp, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_lerp(self, a, b, B)"},
	 { (char *)"_SparseMatrix32_addTwoRows", (PyCFunction) _wrap__SparseMatrix32_addTwoRows, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_addTwoRows(self, src_row, dst_row)"},
	 { (char *)"_SparseMatrix32_addTwoCols", (PyCFunction) _wrap__SparseMatrix32_addTwoCols, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_addTwoCols(self, src_col, dst_col)"},
	 { (char *)"_SparseMatrix32_map", (PyCFunction) _wrap__SparseMatrix32_map, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_map(self, B, C)"},
	 { (char *)"_SparseMatrix32_incrementWithOuterProduct", (PyCFunction) _wrap__SparseMatrix32_incrementWithOuterProduct, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_incrementWithOuterProduct(self, x, y)"},
	 { (char *)"_SparseMatrix32_incrementOnOuterProductVal", (PyCFunction) _wrap__SparseMatrix32_incrementOnOuterProductVal, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_incrementOnOuterProductVal(self, rows, cols, val=1.0)"},
	 { (char *)"_SparseMatrix32_sortRowsAscendingNNZ", (PyCFunction)_wrap__SparseMatrix32_sortRowsAscendingNNZ, METH_O, (char *)"_SparseMatrix32_sortRowsAscendingNNZ(self)"},
	 { (char *)"_SparseMatrix32_replaceNZ", (PyCFunction) _wrap__SparseMatrix32_replaceNZ, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_replaceNZ(self, val=1.0)"},
	 { (char *)"_SparseMatrix32_diagNZProd", (PyCFunction)_wrap__SparseMatrix32_diagNZProd, METH_O, (char *)"_SparseMatrix32_diagNZProd(self) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type"},
	 { (char *)"_SparseMatrix32_diagSum", (PyCFunction)_wrap__SparseMatrix32_diagSum, METH_O, (char *)"_SparseMatrix32_diagSum(self) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type"},
	 { (char *)"_SparseMatrix32_diagNZLogSum", (PyCFunction)_wrap__SparseMatrix32_diagNZLogSum, METH_O, (char *)"_SparseMatrix32_diagNZLogSum(self) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type"},
	 { (char *)"_SparseMatrix32_rowNegate", (PyCFunction) _wrap__SparseMatrix32_rowNegate, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_rowNegate(self, idx)"},
	 { (char *)"_SparseMatrix32_colNegate", (PyCFunction) _wrap__SparseMatrix32_colNegate, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_colNegate(self, idx)"},
	 { (char *)"_SparseMatrix32_negate", (PyCFunction)_wrap__SparseMatrix32_negate, METH_O, (char *)"_SparseMatrix32_negate(self)"},
	 { (char *)"_SparseMatrix32_rowAbs", (PyCFunction) _wrap__SparseMatrix32_rowAbs, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_rowAbs(self, idx)"},
	 { (char *)"_SparseMatrix32_colAbs", (PyCFunction) _wrap__SparseMatrix32_colAbs, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_colAbs(self, idx)"},
	 { (char *)"_SparseMatrix32_abs", (PyCFunction)_wrap__SparseMatrix32_abs, METH_O, (char *)"_SparseMatrix32_abs(self)"},
	 { (char *)"_SparseMatrix32_elementRowSquare", (PyCFunction) _wrap__SparseMatrix32_elementRowSquare, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_elementRowSquare(self, idx)"},
	 { (char *)"_SparseMatrix32_elementColSquare", (PyCFunction) _wrap__SparseMatrix32_elementColSquare, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_elementColSquare(self, idx)"},
	 { (char *)"_SparseMatrix32_elementSquare", (PyCFunction)_wrap__SparseMatrix32_elementSquare, METH_O, (char *)"_SparseMatrix32_elementSquare(self)"},
	 { (char *)"_SparseMatrix32_elementRowCube", (PyCFunction) _wrap__SparseMatrix32_elementRowCube, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_elementRowCube(self, idx)"},
	 { (char *)"_SparseMatrix32_elementColCube", (PyCFunction) _wrap__SparseMatrix32_elementColCube, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_elementColCube(self, idx)"},
	 { (char *)"_SparseMatrix32_elementCube", (PyCFunction)_wrap__SparseMatrix32_elementCube, METH_O, (char *)"_SparseMatrix32_elementCube(self)"},
	 { (char *)"_SparseMatrix32_elementRowNZInverse", (PyCFunction) _wrap__SparseMatrix32_elementRowNZInverse, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_elementRowNZInverse(self, idx)"},
	 { (char *)"_SparseMatrix32_elementColNZInverse", (PyCFunction) _wrap__SparseMatrix32_elementColNZInverse, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_elementColNZInverse(self, idx)"},
	 { (char *)"_SparseMatrix32_elementNZInverse", (PyCFunction)_wrap__SparseMatrix32_elementNZInverse, METH_O, (char *)"_SparseMatrix32_elementNZInverse(self)"},
	 { (char *)"_SparseMatrix32_elementRowSqrt", (PyCFunction) _wrap__SparseMatrix32_elementRowSqrt, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_elementRowSqrt(self, idx)"},
	 { (char *)"_SparseMatrix32_elementColSqrt", (PyCFunction) _wrap__SparseMatrix32_elementColSqrt, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_elementColSqrt(self, idx)"},
	 { (char *)"_SparseMatrix32_elementSqrt", (PyCFunction)_wrap__SparseMatrix32_elementSqrt, METH_O, (char *)"_SparseMatrix32_elementSqrt(self)"},
	 { (char *)"_SparseMatrix32_elementRowNZLog", (PyCFunction) _wrap__SparseMatrix32_elementRowNZLog, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_elementRowNZLog(self, idx)"},
	 { (char *)"_SparseMatrix32_elementColNZLog", (PyCFunction) _wrap__SparseMatrix32_elementColNZLog, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_elementColNZLog(self, idx)"},
	 { (char *)"_SparseMatrix32_elementNZLog", (PyCFunction)_wrap__SparseMatrix32_elementNZLog, METH_O, (char *)"_SparseMatrix32_elementNZLog(self)"},
	 { (char *)"_SparseMatrix32_elementRowNZExp", (PyCFunction) _wrap__SparseMatrix32_elementRowNZExp, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_elementRowNZExp(self, idx)"},
	 { (char *)"_SparseMatrix32_elementColNZExp", (PyCFunction) _wrap__SparseMatrix32_elementColNZExp, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_elementColNZExp(self, idx)"},
	 { (char *)"_SparseMatrix32_elementNZExp", (PyCFunction)_wrap__SparseMatrix32_elementNZExp, METH_O, (char *)"_SparseMatrix32_elementNZExp(self)"},
	 { (char *)"_SparseMatrix32_multiply", _wrap__SparseMatrix32_multiply, METH_VARARGS, (char *)"\n"
		"multiply(B, C)\n"
		"_SparseMatrix32_multiply(self, val)\n"
		""},
	 { (char *)"_SparseMatrix32_divide", (PyCFunction) _wrap__SparseMatrix32_divide, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_divide(self, val)"},
	 { (char *)"_SparseMatrix32_elementRowNZPow", (PyCFunction) _wrap__SparseMatrix32_elementRowNZPow, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_elementRowNZPow(self, idx, val)"},
	 { (char *)"_SparseMatrix32_elementColNZPow", (PyCFunction) _wrap__SparseMatrix32_elementColNZPow, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_elementColNZPow(self, idx, val)"},
	 { (char *)"_SparseMatrix32_elementNZPow", (PyCFunction) _wrap__SparseMatrix32_elementNZPow, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_elementNZPow(self, val)"},
	 { (char *)"_SparseMatrix32_elementRowNZLogk", (PyCFunction) _wrap__SparseMatrix32_elementRowNZLogk, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_elementRowNZLogk(self, idx, val)"},
	 { (char *)"_SparseMatrix32_elementColNZLogk", (PyCFunction) _wrap__SparseMatrix32_elementColNZLogk, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_elementColNZLogk(self, idx, val)"},
	 { (char *)"_SparseMatrix32_elementNZLogk", (PyCFunction) _wrap__SparseMatrix32_elementNZLogk, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_elementNZLogk(self, val)"},
	 { (char *)"_SparseMatrix32_rowAdd", (PyCFunction) _wrap__SparseMatrix32_rowAdd, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_rowAdd(self, idx, val)"},
	 { (char *)"_SparseMatrix32_colAdd", (PyCFunction) _wrap__SparseMatrix32_colAdd, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_colAdd(self, idx, val)"},
	 { (char *)"_SparseMatrix32_add", _wrap__SparseMatrix32_add, METH_VARARGS, (char *)"\n"
		"add(other)\n"
		"_SparseMatrix32_add(self, val)\n"
		""},
	 { (char *)"_SparseMatrix32_elementNZAdd", (PyCFunction) _wrap__SparseMatrix32_elementNZAdd, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_elementNZAdd(self, val)"},
	 { (char *)"_SparseMatrix32_rowSubtract", (PyCFunction) _wrap__SparseMatrix32_rowSubtract, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_rowSubtract(self, idx, val)"},
	 { (char *)"_SparseMatrix32_colSubtract", (PyCFunction) _wrap__SparseMatrix32_colSubtract, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_colSubtract(self, idx, val)"},
	 { (char *)"_SparseMatrix32_elementNZMultiply", (PyCFunction) _wrap__SparseMatrix32_elementNZMultiply, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_elementNZMultiply(self, other)"},
	 { (char *)"_SparseMatrix32_elementNZDivide", (PyCFunction) _wrap__SparseMatrix32_elementNZDivide, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_elementNZDivide(self, other)"},
	 { (char *)"_SparseMatrix32_subtract", _wrap__SparseMatrix32_subtract, METH_VARARGS, (char *)"\n"
		"subtract(val)\n"
		"_SparseMatrix32_subtract(self, other)\n"
		""},
	 { (char *)"_SparseMatrix32___iadd__", (PyCFunction) _wrap__SparseMatrix32___iadd__, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32___iadd__(self, val)"},
	 { (char *)"_SparseMatrix32___isub__", (PyCFunction) _wrap__SparseMatrix32___isub__, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32___isub__(self, val)"},
	 { (char *)"_SparseMatrix32___imul__", (PyCFunction) _wrap__SparseMatrix32___imul__, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32___imul__(self, val)"},
	 { (char *)"_SparseMatrix32___idiv__", (PyCFunction) _wrap__SparseMatrix32___idiv__, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32___idiv__(self, val)"},
	 { (char *)"_SparseMatrix32___initializeWithRows", (PyCFunction) _wrap__SparseMatrix32___initializeWithRows, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32___initializeWithRows(self, other, py_take)"},
	 { (char *)"_SparseMatrix32___initializeWithCols", (PyCFunction) _wrap__SparseMatrix32___initializeWithCols, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32___initializeWithCols(self, other, py_take)"},
	 { (char *)"_SparseMatrix32___add", (PyCFunction) _wrap__SparseMatrix32___add, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32___add(self, val)"},
	 { (char *)"_SparseMatrix32___multiply", (PyCFunction) _wrap__SparseMatrix32___multiply, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32___multiply(self, val)"},
	 { (char *)"_SparseMatrix32___subtract", (PyCFunction) _wrap__SparseMatrix32___subtract, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32___subtract(self, val)"},
	 { (char *)"_SparseMatrix32___divide", (PyCFunction) _wrap__SparseMatrix32___divide, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32___divide(self, val)"},
	 { (char *)"_SparseMatrix32_copy", (PyCFunction) _wrap__SparseMatrix32_copy, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_copy(self, other)"},
	 { (char *)"_SparseMatrix32_fromDense", (PyCFunction) _wrap__SparseMatrix32_fromDense, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_fromDense(self, matrix)"},
	 { (char *)"_SparseMatrix32_toDense", (PyCFunction)_wrap__SparseMatrix32_toDense, METH_O, (char *)"_SparseMatrix32_toDense(self) -> PyObject *"},
	 { (char *)"_SparseMatrix32__setRowFromDense", (PyCFunction) _wrap__SparseMatrix32__setRowFromDense, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32__setRowFromDense(self, row, py_row)"},
	 { (char *)"_SparseMatrix32_setRowFromSparse", (PyCFunction) _wrap__SparseMatrix32_setRowFromSparse, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_setRowFromSparse(self, row, py_ind, py_nz)"},
	 { (char *)"_SparseMatrix32_binarySaveToFile", (PyCFunction) _wrap__SparseMatrix32_binarySaveToFile, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_binarySaveToFile(self, filename)"},
	 { (char *)"_SparseMatrix32_binaryLoadFromFile", (PyCFunction) _wrap__SparseMatrix32_binaryLoadFromFile, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_binaryLoadFromFile(self, filename)"},
	 { (char *)"_SparseMatrix32_write", _wrap__SparseMatrix32_write, METH_VARARGS, (char *)"\n"
		"write(proto)\n"
		"_SparseMatrix32_write(self, pyBuilder)\n"
		""},
	 { (char *)"_SparseMatrix32_read", _wrap__SparseMatrix32_read, METH_VARARGS, (char *)"\n"
		"read(proto)\n"
		"_SparseMatrix32_read(self, pyReader)\n"
		""},
	 { (char *)"_SparseMatrix32_addRow", (PyCFunction) _wrap__SparseMatrix32_addRow, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_addRow(self, row)"},
	 { (char *)"_SparseMatrix32_addRowNZ", (PyCFunction) _wrap__SparseMatrix32_addRowNZ, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_addRowNZ(self, ind, nz, zero_permissive=False)"},
	 { (char *)"_SparseMatrix32_addCol", (PyCFunction) _wrap__SparseMatrix32_addCol, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_addCol(self, col)"},
	 { (char *)"_SparseMatrix32_addColNZ", (PyCFunction) _wrap__SparseMatrix32_addColNZ, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_addColNZ(self, ind, nz)"},
	 { (char *)"_SparseMatrix32_deleteRows", (PyCFunction) _wrap__SparseMatrix32_deleteRows, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_deleteRows(self, rowIndices)"},
	 { (char *)"_SparseMatrix32_deleteCols", (PyCFunction) _wrap__SparseMatrix32_deleteCols, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_deleteCols(self, colIndices)"},
	 { (char *)"_SparseMatrix32_getRow", (PyCFunction) _wrap__SparseMatrix32_getRow, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_getRow(self, row) -> PyObject *"},
	 { (char *)"_SparseMatrix32_getCol", (PyCFunction) _wrap__SparseMatrix32_getCol, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_getCol(self, col) -> PyObject *"},
	 { (char *)"_SparseMatrix32_getDiagonal", (PyCFunction)_wrap__SparseMatrix32_getDiagonal, METH_O, (char *)"_SparseMatrix32_getDiagonal(self) -> PyObject *"},
	 { (char *)"_SparseMatrix32_rowNonZeros", (PyCFunction) _wrap__SparseMatrix32_rowNonZeros, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_rowNonZeros(self, row) -> PyObject *"},
	 { (char *)"_SparseMatrix32_rowNonZeroIndices", (PyCFunction) _wrap__SparseMatrix32_rowNonZeroIndices, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_rowNonZeroIndices(self, row) -> PyObject *"},
	 { (char *)"_SparseMatrix32_colNonZeros", (PyCFunction) _wrap__SparseMatrix32_colNonZeros, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_colNonZeros(self, col) -> PyObject *"},
	 { (char *)"_SparseMatrix32_nonZeroRows", (PyCFunction)_wrap__SparseMatrix32_nonZeroRows, METH_O, (char *)"_SparseMatrix32_nonZeroRows(self) -> PyObject *"},
	 { (char *)"_SparseMatrix32_zeroRows", (PyCFunction)_wrap__SparseMatrix32_zeroRows, METH_O, (char *)"_SparseMatrix32_zeroRows(self) -> PyObject *"},
	 { (char *)"_SparseMatrix32_nonZeroCols", (PyCFunction)_wrap__SparseMatrix32_nonZeroCols, METH_O, (char *)"_SparseMatrix32_nonZeroCols(self) -> PyObject *"},
	 { (char *)"_SparseMatrix32_zeroCols", (PyCFunction)_wrap__SparseMatrix32_zeroCols, METH_O, (char *)"_SparseMatrix32_zeroCols(self) -> PyObject *"},
	 { (char *)"_SparseMatrix32_zeroRowAndCol", (PyCFunction)_wrap__SparseMatrix32_zeroRowAndCol, METH_O, (char *)"_SparseMatrix32_zeroRowAndCol(self) -> PyObject *"},
	 { (char *)"_SparseMatrix32_setElements", (PyCFunction) _wrap__SparseMatrix32_setElements, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_setElements(self, py_i, py_j, py_v)"},
	 { (char *)"_SparseMatrix32_getElements", (PyCFunction) _wrap__SparseMatrix32_getElements, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_getElements(self, py_i, py_j) -> PyObject *"},
	 { (char *)"_SparseMatrix32_setOuter", (PyCFunction) _wrap__SparseMatrix32_setOuter, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_setOuter(self, py_i, py_j, py_v)"},
	 { (char *)"_SparseMatrix32_getOuter", (PyCFunction) _wrap__SparseMatrix32_getOuter, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_getOuter(self, py_i, py_j) -> _SparseMatrix32"},
	 { (char *)"_SparseMatrix32_getAllNonZeros", (PyCFunction) _wrap__SparseMatrix32_getAllNonZeros, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_getAllNonZeros(self, three_lists=False) -> PyObject *"},
	 { (char *)"_SparseMatrix32_setAllNonZeros", (PyCFunction) _wrap__SparseMatrix32_setAllNonZeros, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_setAllNonZeros(self, nrows, ncols, py_i, py_j, py_v, sorted=True)"},
	 { (char *)"_SparseMatrix32_getNonZerosInBox", (PyCFunction) _wrap__SparseMatrix32_getNonZerosInBox, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_getNonZerosInBox(self, row_begin, row_end, col_begin, col_end) -> PyObject *"},
	 { (char *)"_SparseMatrix32_tolist", (PyCFunction)_wrap__SparseMatrix32_tolist, METH_O, (char *)"_SparseMatrix32_tolist(self) -> PyObject *"},
	 { (char *)"_SparseMatrix32_setSlice", _wrap__SparseMatrix32_setSlice, METH_VARARGS, (char *)"\n"
		"setSlice(i_begin, j_begin, other)\n"
		"_SparseMatrix32_setSlice(self, i_begin, j_begin, py_other)\n"
		""},
	 { (char *)"_SparseMatrix32_getSlice", (PyCFunction) _wrap__SparseMatrix32_getSlice, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_getSlice(self, i_begin, i_end, j_begin, j_end) -> _SparseMatrix32"},
	 { (char *)"_SparseMatrix32_getSlice2", _wrap__SparseMatrix32_getSlice2, METH_VARARGS, (char *)"\n"
		"getSlice2(src_first_row, src_row_end, src_first_col, src_col_end, other)\n"
		"_SparseMatrix32_getSlice2(self, i_begin, i_end, j_begin, j_end) -> _SparseMatrix32\n"
		""},
	 { (char *)"_SparseMatrix32_setRowsToZero", (PyCFunction) _wrap__SparseMatrix32_setRowsToZero, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_setRowsToZero(self, py_rows)"},
	 { (char *)"_SparseMatrix32_setColsToZero", (PyCFunction) _wrap__SparseMatrix32_setColsToZero, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_setColsToZero(self, py_cols)"},
	 { (char *)"_SparseMatrix32_setDiagonal", (PyCFunction) _wrap__SparseMatrix32_setDiagonal, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_setDiagonal(self, py_v)"},
	 { (char *)"_SparseMatrix32_incrementOnOuterWNZ", (PyCFunction) _wrap__SparseMatrix32_incrementOnOuterWNZ, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_incrementOnOuterWNZ(self, py_i, py_j, delta=1)"},
	 { (char *)"_SparseMatrix32_incrementOnOuterWNZWThreshold", (PyCFunction) _wrap__SparseMatrix32_incrementOnOuterWNZWThreshold, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_incrementOnOuterWNZWThreshold(self, py_i, py_j, threshold, delta=1)"},
	 { (char *)"_SparseMatrix32_nNonZerosPerRow", (PyCFunction)_wrap__SparseMatrix32_nNonZerosPerRow, METH_O, (char *)"_SparseMatrix32_nNonZerosPerRow(self) -> PyObject *"},
	 { (char *)"_SparseMatrix32_nNonZerosPerCol", (PyCFunction)_wrap__SparseMatrix32_nNonZerosPerCol, METH_O, (char *)"_SparseMatrix32_nNonZerosPerCol(self) -> PyObject *"},
	 { (char *)"_SparseMatrix32_rowBandwidths", (PyCFunction)_wrap__SparseMatrix32_rowBandwidths, METH_O, (char *)"_SparseMatrix32_rowBandwidths(self) -> PyObject *"},
	 { (char *)"_SparseMatrix32_colBandwidths", (PyCFunction)_wrap__SparseMatrix32_colBandwidths, METH_O, (char *)"_SparseMatrix32_colBandwidths(self) -> PyObject *"},
	 { (char *)"_SparseMatrix32_nNonZerosPerBox", (PyCFunction) _wrap__SparseMatrix32_nNonZerosPerBox, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_nNonZerosPerBox(self, box_i, box_j) -> _SparseMatrix32"},
	 { (char *)"_SparseMatrix32_max", _wrap__SparseMatrix32_max, METH_VARARGS, (char *)"\n"
		"max(max_row, max_col, max_val)\n"
		"_SparseMatrix32_max(self) -> PyObject *\n"
		""},
	 { (char *)"_SparseMatrix32_min", _wrap__SparseMatrix32_min, METH_VARARGS, (char *)"\n"
		"min(min_row, min_col, min_val)\n"
		"_SparseMatrix32_min(self) -> PyObject *\n"
		""},
	 { (char *)"_SparseMatrix32_rowMax", _wrap__SparseMatrix32_rowMax, METH_VARARGS, (char *)"\n"
		"rowMax(row, row_max_j, row_max)\n"
		"rowMax(row_index) -> PyObject\n"
		"_SparseMatrix32_rowMax(self) -> PyObject *\n"
		""},
	 { (char *)"_SparseMatrix32_rowMin", _wrap__SparseMatrix32_rowMin, METH_VARARGS, (char *)"\n"
		"rowMin(row, row_min_j, row_min)\n"
		"rowMin(row_index) -> PyObject\n"
		"_SparseMatrix32_rowMin(self) -> PyObject *\n"
		""},
	 { (char *)"_SparseMatrix32_colMax", _wrap__SparseMatrix32_colMax, METH_VARARGS, (char *)"\n"
		"colMax(col, col_max_i, col_max)\n"
		"colMax(row_index) -> PyObject\n"
		"_SparseMatrix32_colMax(self) -> PyObject *\n"
		""},
	 { (char *)"_SparseMatrix32_colMin", _wrap__SparseMatrix32_colMin, METH_VARARGS, (char *)"\n"
		"colMin(col, col_min_i, col_min)\n"
		"colMin(col_index) -> PyObject\n"
		"_SparseMatrix32_colMin(self) -> PyObject *\n"
		""},
	 { (char *)"_SparseMatrix32_boxMin", _wrap__SparseMatrix32_boxMin, METH_VARARGS, (char *)"\n"
		"boxMin(begin_row, end_row, begin_col, end_col, min_row, min_col, min_val)\n"
		"_SparseMatrix32_boxMin(self, begin_row, end_row, begin_col, end_col) -> PyObject *\n"
		""},
	 { (char *)"_SparseMatrix32_boxMax", _wrap__SparseMatrix32_boxMax, METH_VARARGS, (char *)"\n"
		"boxMax(begin_row, end_row, begin_col, end_col, max_row, max_col, max_val)\n"
		"_SparseMatrix32_boxMax(self, begin_row, end_row, begin_col, end_col) -> PyObject *\n"
		""},
	 { (char *)"_SparseMatrix32_whereEqual", (PyCFunction) _wrap__SparseMatrix32_whereEqual, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_whereEqual(self, begin_row, end_row, begin_col, end_col, value) -> PyObject *"},
	 { (char *)"_SparseMatrix32_whereGreater", (PyCFunction) _wrap__SparseMatrix32_whereGreater, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_whereGreater(self, begin_row, end_row, begin_col, end_col, value) -> PyObject *"},
	 { (char *)"_SparseMatrix32_whereGreaterEqual", (PyCFunction) _wrap__SparseMatrix32_whereGreaterEqual, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_whereGreaterEqual(self, begin_row, end_row, begin_col, end_col, value) -> PyObject *"},
	 { (char *)"_SparseMatrix32_countWhereGreaterOrEqual", (PyCFunction) _wrap__SparseMatrix32_countWhereGreaterOrEqual, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_countWhereGreaterOrEqual(self, begin_row, end_row, begin_col, end_col, value) -> nupic::UInt32"},
	 { (char *)"_SparseMatrix32_permuteRows", (PyCFunction) _wrap__SparseMatrix32_permuteRows, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_permuteRows(self, py_permutation)"},
	 { (char *)"_SparseMatrix32_permuteCols", (PyCFunction) _wrap__SparseMatrix32_permuteCols, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_permuteCols(self, py_permutation)"},
	 { (char *)"_SparseMatrix32_rowSums", _wrap__SparseMatrix32_rowSums, METH_VARARGS, (char *)"\n"
		"rowSums(sums)\n"
		"_SparseMatrix32_rowSums(self) -> PyObject *\n"
		""},
	 { (char *)"_SparseMatrix32_colSums", (PyCFunction)_wrap__SparseMatrix32_colSums, METH_O, (char *)"_SparseMatrix32_colSums(self) -> PyObject *"},
	 { (char *)"_SparseMatrix32_addRows", (PyCFunction) _wrap__SparseMatrix32_addRows, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_addRows(self, whichRows) -> PyObject *"},
	 { (char *)"_SparseMatrix32_addListOfRows", (PyCFunction) _wrap__SparseMatrix32_addListOfRows, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_addListOfRows(self, py_whichRows) -> PyObject *"},
	 { (char *)"_SparseMatrix32_rowProds", (PyCFunction)_wrap__SparseMatrix32_rowProds, METH_O, (char *)"_SparseMatrix32_rowProds(self) -> PyObject *"},
	 { (char *)"_SparseMatrix32_colProds", (PyCFunction)_wrap__SparseMatrix32_colProds, METH_O, (char *)"_SparseMatrix32_colProds(self) -> PyObject *"},
	 { (char *)"_SparseMatrix32_logRowSums", (PyCFunction)_wrap__SparseMatrix32_logRowSums, METH_O, (char *)"_SparseMatrix32_logRowSums(self) -> PyObject *"},
	 { (char *)"_SparseMatrix32_logColSums", (PyCFunction)_wrap__SparseMatrix32_logColSums, METH_O, (char *)"_SparseMatrix32_logColSums(self) -> PyObject *"},
	 { (char *)"_SparseMatrix32_scaleRows", (PyCFunction) _wrap__SparseMatrix32_scaleRows, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_scaleRows(self, py_s)"},
	 { (char *)"_SparseMatrix32_scaleCols", (PyCFunction) _wrap__SparseMatrix32_scaleCols, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_scaleCols(self, py_s)"},
	 { (char *)"_SparseMatrix32_normalizeBlockByRows", (PyCFunction) _wrap__SparseMatrix32_normalizeBlockByRows, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_normalizeBlockByRows(self, py_inds, val=-1.0, eps_n=1e-6)"},
	 { (char *)"_SparseMatrix32_normalizeBlockByRows_binary", (PyCFunction) _wrap__SparseMatrix32_normalizeBlockByRows_binary, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_normalizeBlockByRows_binary(self, py_inds, val=-1.0, eps_n=1e-6)"},
	 { (char *)"_SparseMatrix32_axby", _wrap__SparseMatrix32_axby, METH_VARARGS, (char *)"\n"
		"axby(row, a, b, xIn)\n"
		"_SparseMatrix32_axby(self, a, b, xIn)\n"
		""},
	 { (char *)"_SparseMatrix32_rightVecProd_fast", (PyCFunction) _wrap__SparseMatrix32_rightVecProd_fast, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_rightVecProd_fast(self, xIn, yOut)"},
	 { (char *)"_SparseMatrix32_rightVecProd", _wrap__SparseMatrix32_rightVecProd, METH_VARARGS, (char *)"\n"
		"rightVecProd(row, x) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type\n"
		"rightVecProd(x, y)\n"
		"rightVecProd(row, xIn) -> nupic::Real32\n"
		"rightVecProd(xIn) -> PyObject\n"
		"_SparseMatrix32_rightVecProd(self, pyRows, xIn) -> PyObject *\n"
		""},
	 { (char *)"_SparseMatrix32_blockRightVecProd", (PyCFunction) _wrap__SparseMatrix32_blockRightVecProd, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_blockRightVecProd(self, block_size, xIn) -> _SparseMatrix32"},
	 { (char *)"_SparseMatrix32_leftVecProd", _wrap__SparseMatrix32_leftVecProd, METH_VARARGS, (char *)"\n"
		"leftVecProd(col, x) -> nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type\n"
		"leftVecProd(x, y)\n"
		"leftVecProd(col, xIn) -> nupic::Real32\n"
		"leftVecProd(xIn) -> PyObject\n"
		"_SparseMatrix32_leftVecProd(self, pyCols, xIn) -> PyObject *\n"
		""},
	 { (char *)"_SparseMatrix32_leftVecProd_binary", (PyCFunction) _wrap__SparseMatrix32_leftVecProd_binary, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_leftVecProd_binary(self, pyCols, xIn) -> PyObject *"},
	 { (char *)"_SparseMatrix32_rightDenseMatProd", (PyCFunction) _wrap__SparseMatrix32_rightDenseMatProd, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_rightDenseMatProd(self, mIn) -> PyObject *"},
	 { (char *)"_SparseMatrix32_rightDenseMatProdAtNZ", (PyCFunction) _wrap__SparseMatrix32_rightDenseMatProdAtNZ, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_rightDenseMatProdAtNZ(self, mIn) -> PyObject *"},
	 { (char *)"_SparseMatrix32_denseMatExtract", (PyCFunction) _wrap__SparseMatrix32_denseMatExtract, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_denseMatExtract(self, mIn) -> PyObject *"},
	 { (char *)"_SparseMatrix32_leftDenseMatProd", (PyCFunction) _wrap__SparseMatrix32_leftDenseMatProd, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_leftDenseMatProd(self, mIn) -> PyObject *"},
	 { (char *)"_SparseMatrix32_elementRowAdd", (PyCFunction) _wrap__SparseMatrix32_elementRowAdd, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_elementRowAdd(self, i, xIn)"},
	 { (char *)"_SparseMatrix32_elementRowSubtract", (PyCFunction) _wrap__SparseMatrix32_elementRowSubtract, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_elementRowSubtract(self, i, xIn)"},
	 { (char *)"_SparseMatrix32_elementRowMultiply", _wrap__SparseMatrix32_elementRowMultiply, METH_VARARGS, (char *)"\n"
		"elementRowMultiply(row, val)\n"
		"elementRowMultiply(row, x, y)\n"
		"_SparseMatrix32_elementRowMultiply(self, i, xIn)\n"
		""},
	 { (char *)"_SparseMatrix32_elementRowDivide", _wrap__SparseMatrix32_elementRowDivide, METH_VARARGS, (char *)"\n"
		"elementRowDivide(idx, val)\n"
		"_SparseMatrix32_elementRowDivide(self, i, xIn)\n"
		""},
	 { (char *)"_SparseMatrix32_elementColAdd", (PyCFunction) _wrap__SparseMatrix32_elementColAdd, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_elementColAdd(self, i, xIn)"},
	 { (char *)"_SparseMatrix32_elementColSubtract", (PyCFunction) _wrap__SparseMatrix32_elementColSubtract, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_elementColSubtract(self, i, xIn)"},
	 { (char *)"_SparseMatrix32_elementColMultiply", _wrap__SparseMatrix32_elementColMultiply, METH_VARARGS, (char *)"\n"
		"elementColMultiply(col, val)\n"
		"elementColMultiply(col, x, y)\n"
		"_SparseMatrix32_elementColMultiply(self, i, xIn)\n"
		""},
	 { (char *)"_SparseMatrix32_elementColDivide", _wrap__SparseMatrix32_elementColDivide, METH_VARARGS, (char *)"\n"
		"elementColDivide(idx, val)\n"
		"_SparseMatrix32_elementColDivide(self, i, xIn)\n"
		""},
	 { (char *)"_SparseMatrix32_elementMultiply", _wrap__SparseMatrix32_elementMultiply, METH_VARARGS, (char *)"\n"
		"elementMultiply(b)\n"
		"elementMultiply(m, result)\n"
		"elementMultiply(dense)\n"
		"elementMultiply(dense, result)\n"
		"_SparseMatrix32_elementMultiply(self, mIn)\n"
		""},
	 { (char *)"_SparseMatrix32_rightVecProdAtNZ", (PyCFunction) _wrap__SparseMatrix32_rightVecProdAtNZ, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_rightVecProdAtNZ(self, xIn) -> PyObject *"},
	 { (char *)"_SparseMatrix32_leftVecProdAtNZ", (PyCFunction) _wrap__SparseMatrix32_leftVecProdAtNZ, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_leftVecProdAtNZ(self, xIn) -> PyObject *"},
	 { (char *)"_SparseMatrix32_rightVecSumAtNZ", (PyCFunction) _wrap__SparseMatrix32_rightVecSumAtNZ, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_rightVecSumAtNZ(self, xIn) -> PyObject *"},
	 { (char *)"_SparseMatrix32_rightVecSumAtNZGtThreshold", (PyCFunction) _wrap__SparseMatrix32_rightVecSumAtNZGtThreshold, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_rightVecSumAtNZGtThreshold(self, xIn, threshold) -> PyObject *"},
	 { (char *)"_SparseMatrix32_rightVecSumAtNZ_fast", (PyCFunction) _wrap__SparseMatrix32_rightVecSumAtNZ_fast, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_rightVecSumAtNZ_fast(self, xIn, yOut)"},
	 { (char *)"_SparseMatrix32_leftVecSumAtNZ", (PyCFunction) _wrap__SparseMatrix32_leftVecSumAtNZ, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_leftVecSumAtNZ(self, xIn) -> PyObject *"},
	 { (char *)"_SparseMatrix32_leftVecSumAtNZ_fast", (PyCFunction) _wrap__SparseMatrix32_leftVecSumAtNZ_fast, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_leftVecSumAtNZ_fast(self, xIn, yOut)"},
	 { (char *)"_SparseMatrix32_rightVecSumAtNZGtThreshold_fast", (PyCFunction) _wrap__SparseMatrix32_rightVecSumAtNZGtThreshold_fast, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_rightVecSumAtNZGtThreshold_fast(self, xIn, yOut, threshold)"},
	 { (char *)"_SparseMatrix32_leftDenseMatProdAtNZ", (PyCFunction) _wrap__SparseMatrix32_leftDenseMatProdAtNZ, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_leftDenseMatProdAtNZ(self, mIn) -> PyObject *"},
	 { (char *)"_SparseMatrix32_rightDenseMatSumAtNZ", (PyCFunction) _wrap__SparseMatrix32_rightDenseMatSumAtNZ, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_rightDenseMatSumAtNZ(self, mIn) -> PyObject *"},
	 { (char *)"_SparseMatrix32_leftDenseMatSumAtNZ", (PyCFunction) _wrap__SparseMatrix32_leftDenseMatSumAtNZ, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_leftDenseMatSumAtNZ(self, mIn) -> PyObject *"},
	 { (char *)"_SparseMatrix32_rightDenseMatMaxAtNZ", (PyCFunction) _wrap__SparseMatrix32_rightDenseMatMaxAtNZ, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_rightDenseMatMaxAtNZ(self, mIn) -> PyObject *"},
	 { (char *)"_SparseMatrix32_leftDenseMatMaxAtNZ", (PyCFunction) _wrap__SparseMatrix32_leftDenseMatMaxAtNZ, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_leftDenseMatMaxAtNZ(self, mIn) -> PyObject *"},
	 { (char *)"_SparseMatrix32_vecArgMaxAtNZ", (PyCFunction) _wrap__SparseMatrix32_vecArgMaxAtNZ, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_vecArgMaxAtNZ(self, xIn) -> PyObject *"},
	 { (char *)"_SparseMatrix32_vecMaxAtNZ", (PyCFunction) _wrap__SparseMatrix32_vecMaxAtNZ, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_vecMaxAtNZ(self, xIn) -> PyObject *"},
	 { (char *)"_SparseMatrix32_rowVecProd", (PyCFunction) _wrap__SparseMatrix32_rowVecProd, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_rowVecProd(self, xIn, lb=Epsilon) -> PyObject *"},
	 { (char *)"_SparseMatrix32_vecMaxProd", (PyCFunction) _wrap__SparseMatrix32_vecMaxProd, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_vecMaxProd(self, xIn) -> PyObject *"},
	 { (char *)"_SparseMatrix32_vecArgMaxProd", (PyCFunction) _wrap__SparseMatrix32_vecArgMaxProd, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_vecArgMaxProd(self, xIn) -> PyObject *"},
	 { (char *)"_SparseMatrix32_getNonZerosSorted", (PyCFunction) _wrap__SparseMatrix32_getNonZerosSorted, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_getNonZerosSorted(self, n=-1, ascending_values=True) -> PyObject *"},
	 { (char *)"_SparseMatrix32_threshold", _wrap__SparseMatrix32_threshold, METH_VARARGS, (char *)"\n"
		"threshold(threshold=Epsilon)\n"
		"_SparseMatrix32_threshold(self, threshold, getCuts=False) -> PyObject *\n"
		""},
	 { (char *)"_SparseMatrix32_toPyString", (PyCFunction)_wrap__SparseMatrix32_toPyString, METH_O, (char *)"_SparseMatrix32_toPyString(self) -> PyObject *"},
	 { (char *)"_SparseMatrix32_fromPyString", (PyCFunction) _wrap__SparseMatrix32_fromPyString, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32_fromPyString(self, s) -> bool"},
	 { (char *)"_SparseMatrix32___eq__", (PyCFunction) _wrap__SparseMatrix32___eq__, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32___eq__(self, other) -> bool"},
	 { (char *)"_SparseMatrix32___ne__", (PyCFunction) _wrap__SparseMatrix32___ne__, METH_VARARGS | METH_KEYWORDS, (char *)"_SparseMatrix32___ne__(self, other) -> bool"},
	 { (char *)"_SparseMatrix32_swigregister", _SparseMatrix32_swigregister, METH_VARARGS, NULL},
	 { (char *)"new__SM_01_32_32", _wrap_new__SM_01_32_32, METH_VARARGS, (char *)"\n"
		"_SM_01_32_32()\n"
		"_SM_01_32_32(inStream)\n"
		"_SM_01_32_32(ncols)\n"
		"_SM_01_32_32(nrows, ncols)\n"
		"new__SM_01_32_32(o) -> _SM_01_32_32\n"
		""},
	 { (char *)"_SM_01_32_32_copy", (PyCFunction) _wrap__SM_01_32_32_copy, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_copy(self, o)"},
	 { (char *)"delete__SM_01_32_32", (PyCFunction)_wrap_delete__SM_01_32_32, METH_O, (char *)"delete__SM_01_32_32(self)"},
	 { (char *)"_SM_01_32_32_randomInitialize", (PyCFunction) _wrap__SM_01_32_32_randomInitialize, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_randomInitialize(self, nnz, seed=0)"},
	 { (char *)"_SM_01_32_32_getVersion", (PyCFunction) _wrap__SM_01_32_32_getVersion, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_getVersion(self, binary=False) -> std::string const"},
	 { (char *)"_SM_01_32_32_nRows", (PyCFunction)_wrap__SM_01_32_32_nRows, METH_O, (char *)"_SM_01_32_32_nRows(self) -> nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type"},
	 { (char *)"_SM_01_32_32_nCols", (PyCFunction)_wrap__SM_01_32_32_nCols, METH_O, (char *)"_SM_01_32_32_nCols(self) -> nupic::SparseBinaryMatrix< unsigned int,unsigned int >::nz_index_type"},
	 { (char *)"_SM_01_32_32_capacity", (PyCFunction)_wrap__SM_01_32_32_capacity, METH_O, (char *)"_SM_01_32_32_capacity(self) -> nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type"},
	 { (char *)"_SM_01_32_32_nBytes", (PyCFunction)_wrap__SM_01_32_32_nBytes, METH_O, (char *)"_SM_01_32_32_nBytes(self) -> nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type"},
	 { (char *)"_SM_01_32_32_compact", (PyCFunction)_wrap__SM_01_32_32_compact, METH_O, (char *)"_SM_01_32_32_compact(self)"},
	 { (char *)"_SM_01_32_32_clear", (PyCFunction)_wrap__SM_01_32_32_clear, METH_O, (char *)"_SM_01_32_32_clear(self)"},
	 { (char *)"_SM_01_32_32_resize", (PyCFunction) _wrap__SM_01_32_32_resize, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_resize(self, new_nrows, new_ncols)"},
	 { (char *)"_SM_01_32_32_nNonZerosOnRow", (PyCFunction) _wrap__SM_01_32_32_nNonZerosOnRow, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_nNonZerosOnRow(self, row) -> nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type"},
	 { (char *)"_SM_01_32_32_nNonZeros", (PyCFunction)_wrap__SM_01_32_32_nNonZeros, METH_O, (char *)"_SM_01_32_32_nNonZeros(self) -> nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type"},
	 { (char *)"_SM_01_32_32_nNonZerosInRowRange", (PyCFunction) _wrap__SM_01_32_32_nNonZerosInRowRange, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_nNonZerosInRowRange(self, row, col_begin, col_end) -> nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type"},
	 { (char *)"_SM_01_32_32_nNonZerosInBox", (PyCFunction) _wrap__SM_01_32_32_nNonZerosInBox, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_nNonZerosInBox(self, row_begin, row_end, col_begin, col_end) -> nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type"},
	 { (char *)"_SM_01_32_32_get", (PyCFunction) _wrap__SM_01_32_32_get, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_get(self, row, col) -> nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type"},
	 { (char *)"_SM_01_32_32_get_linear", (PyCFunction) _wrap__SM_01_32_32_get_linear, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_get_linear(self, n) -> nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type"},
	 { (char *)"_SM_01_32_32_ind_begin_", (PyCFunction) _wrap__SM_01_32_32_ind_begin_, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_ind_begin_(self, row) -> nupic::SparseBinaryMatrix< unsigned int,unsigned int >::Row::const_iterator"},
	 { (char *)"_SM_01_32_32_ind_end_", (PyCFunction) _wrap__SM_01_32_32_ind_end_, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_ind_end_(self, row) -> nupic::SparseBinaryMatrix< unsigned int,unsigned int >::Row::const_iterator"},
	 { (char *)"_SM_01_32_32_getSparseRow", (PyCFunction) _wrap__SM_01_32_32_getSparseRow, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_getSparseRow(self, row) -> VectorOfUInt32"},
	 { (char *)"_SM_01_32_32_appendEmptyCols", (PyCFunction) _wrap__SM_01_32_32_appendEmptyCols, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_appendEmptyCols(self, n)"},
	 { (char *)"_SM_01_32_32_setRangeToZero", (PyCFunction) _wrap__SM_01_32_32_setRangeToZero, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_setRangeToZero(self, row, begin, end)"},
	 { (char *)"_SM_01_32_32_setRangeToOne", (PyCFunction) _wrap__SM_01_32_32_setRangeToOne, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_setRangeToOne(self, row, begin, end)"},
	 { (char *)"_SM_01_32_32_transpose", (PyCFunction)_wrap__SM_01_32_32_transpose, METH_O, (char *)"_SM_01_32_32_transpose(self)"},
	 { (char *)"_SM_01_32_32_logicalNot", (PyCFunction)_wrap__SM_01_32_32_logicalNot, METH_O, (char *)"_SM_01_32_32_logicalNot(self)"},
	 { (char *)"_SM_01_32_32_logicalOr", (PyCFunction) _wrap__SM_01_32_32_logicalOr, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_logicalOr(self, o)"},
	 { (char *)"_SM_01_32_32_logicalAnd", (PyCFunction) _wrap__SM_01_32_32_logicalAnd, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_logicalAnd(self, o)"},
	 { (char *)"_SM_01_32_32_inside", (PyCFunction)_wrap__SM_01_32_32_inside, METH_O, (char *)"_SM_01_32_32_inside(self)"},
	 { (char *)"_SM_01_32_32_edges", (PyCFunction) _wrap__SM_01_32_32_edges, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_edges(self, insideBorder=1)"},
	 { (char *)"_SM_01_32_32_CSRSize", (PyCFunction)_wrap__SM_01_32_32_CSRSize, METH_O, (char *)"_SM_01_32_32_CSRSize(self) -> nupic::SparseBinaryMatrix< unsigned int,unsigned int >::size_type"},
	 { (char *)"_SM_01_32_32_fromBinary", (PyCFunction) _wrap__SM_01_32_32_fromBinary, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_fromBinary(self, inStream)"},
	 { (char *)"_SM_01_32_32_toBinary", (PyCFunction) _wrap__SM_01_32_32_toBinary, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_toBinary(self, outStream)"},
	 { (char *)"_SM_01_32_32_equals", (PyCFunction) _wrap__SM_01_32_32_equals, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_equals(self, o) -> bool"},
	 { (char *)"_SM_01_32_32___getstate__", (PyCFunction)_wrap__SM_01_32_32___getstate__, METH_O, (char *)"_SM_01_32_32___getstate__(self) -> PyObject *"},
	 { (char *)"_SM_01_32_32_readState", (PyCFunction) _wrap__SM_01_32_32_readState, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_readState(self, str)"},
	 { (char *)"_SM_01_32_32_set", _wrap__SM_01_32_32_set, METH_VARARGS, (char *)"\n"
		"set(i, j, v)\n"
		"_SM_01_32_32_set(self, row, py_indices, v)\n"
		""},
	 { (char *)"_SM_01_32_32_setForAllRows", (PyCFunction) _wrap__SM_01_32_32_setForAllRows, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_setForAllRows(self, py_indices, v)"},
	 { (char *)"_SM_01_32_32_getAllNonZeros", (PyCFunction) _wrap__SM_01_32_32_getAllNonZeros, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_getAllNonZeros(self, two_lists=False) -> PyObject *"},
	 { (char *)"_SM_01_32_32_setAllNonZeros", (PyCFunction) _wrap__SM_01_32_32_setAllNonZeros, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_setAllNonZeros(self, nrows, ncols, py_i, py_j, sorted=True)"},
	 { (char *)"_SM_01_32_32_setSlice", _wrap__SM_01_32_32_setSlice, METH_VARARGS, (char *)"\n"
		"setSlice(i_begin, j_begin, other)\n"
		"_SM_01_32_32_setSlice(self, i_begin, j_begin, py_other)\n"
		""},
	 { (char *)"_SM_01_32_32_getCol", (PyCFunction) _wrap__SM_01_32_32_getCol, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_getCol(self, col) -> PyObject *"},
	 { (char *)"_SM_01_32_32_zeroRowsIndicator", (PyCFunction)_wrap__SM_01_32_32_zeroRowsIndicator, METH_O, (char *)"_SM_01_32_32_zeroRowsIndicator(self) -> PyObject *"},
	 { (char *)"_SM_01_32_32_nonZeroRowsIndicator", (PyCFunction)_wrap__SM_01_32_32_nonZeroRowsIndicator, METH_O, (char *)"_SM_01_32_32_nonZeroRowsIndicator(self) -> PyObject *"},
	 { (char *)"_SM_01_32_32_nNonZerosPerRow", (PyCFunction)_wrap__SM_01_32_32_nNonZerosPerRow, METH_O, (char *)"_SM_01_32_32_nNonZerosPerRow(self) -> PyObject *"},
	 { (char *)"_SM_01_32_32_nNonZerosPerCol", (PyCFunction)_wrap__SM_01_32_32_nNonZerosPerCol, METH_O, (char *)"_SM_01_32_32_nNonZerosPerCol(self) -> PyObject *"},
	 { (char *)"_SM_01_32_32_nNonZerosPerBox", (PyCFunction) _wrap__SM_01_32_32_nNonZerosPerBox, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_nNonZerosPerBox(self, box_i, box_j) -> _SparseMatrix32"},
	 { (char *)"_SM_01_32_32_rowSums", (PyCFunction)_wrap__SM_01_32_32_rowSums, METH_O, (char *)"_SM_01_32_32_rowSums(self) -> PyObject *"},
	 { (char *)"_SM_01_32_32_colSums", (PyCFunction)_wrap__SM_01_32_32_colSums, METH_O, (char *)"_SM_01_32_32_colSums(self) -> PyObject *"},
	 { (char *)"_SM_01_32_32_overlap", (PyCFunction) _wrap__SM_01_32_32_overlap, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_overlap(self, py_x) -> PyObject *"},
	 { (char *)"_SM_01_32_32_maxAllowedOverlap", (PyCFunction) _wrap__SM_01_32_32_maxAllowedOverlap, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_maxAllowedOverlap(self, maxDistance, py_x) -> bool"},
	 { (char *)"_SM_01_32_32_appendSparseRow", (PyCFunction) _wrap__SM_01_32_32_appendSparseRow, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_appendSparseRow(self, py_x)"},
	 { (char *)"_SM_01_32_32_appendDenseRow", (PyCFunction) _wrap__SM_01_32_32_appendDenseRow, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_appendDenseRow(self, py_x)"},
	 { (char *)"_SM_01_32_32_replaceSparseRow", (PyCFunction) _wrap__SM_01_32_32_replaceSparseRow, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_replaceSparseRow(self, row, py_x)"},
	 { (char *)"_SM_01_32_32_appendSparseCol", (PyCFunction) _wrap__SM_01_32_32_appendSparseCol, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_appendSparseCol(self, py_x)"},
	 { (char *)"_SM_01_32_32_getRowSparse", (PyCFunction) _wrap__SM_01_32_32_getRowSparse, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_getRowSparse(self, row) -> PyObject *"},
	 { (char *)"_SM_01_32_32_findRowSparse", (PyCFunction) _wrap__SM_01_32_32_findRowSparse, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_findRowSparse(self, py_x) -> nupic::UInt32"},
	 { (char *)"_SM_01_32_32_findRowDense", (PyCFunction) _wrap__SM_01_32_32_findRowDense, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_findRowDense(self, py_x) -> nupic::UInt32"},
	 { (char *)"_SM_01_32_32_fromDense", (PyCFunction) _wrap__SM_01_32_32_fromDense, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_fromDense(self, py_m)"},
	 { (char *)"_SM_01_32_32_toDense", (PyCFunction)_wrap__SM_01_32_32_toDense, METH_O, (char *)"_SM_01_32_32_toDense(self) -> PyObject *"},
	 { (char *)"_SM_01_32_32_toCSR", _wrap__SM_01_32_32_toCSR, METH_VARARGS, (char *)"\n"
		"toCSR(outStream)\n"
		"_SM_01_32_32_toCSR(self) -> PyObject *\n"
		""},
	 { (char *)"_SM_01_32_32_fromCSR", _wrap__SM_01_32_32_fromCSR, METH_VARARGS, (char *)"\n"
		"fromCSR(inStream)\n"
		"_SM_01_32_32_fromCSR(self, str)\n"
		""},
	 { (char *)"_SM_01_32_32_toPyString", (PyCFunction)_wrap__SM_01_32_32_toPyString, METH_O, (char *)"_SM_01_32_32_toPyString(self) -> PyObject *"},
	 { (char *)"_SM_01_32_32_fromPyString", (PyCFunction) _wrap__SM_01_32_32_fromPyString, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_fromPyString(self, s) -> bool"},
	 { (char *)"_SM_01_32_32_CSRSaveToFile", (PyCFunction) _wrap__SM_01_32_32_CSRSaveToFile, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_CSRSaveToFile(self, filename)"},
	 { (char *)"_SM_01_32_32_CSRLoadFromFile", (PyCFunction) _wrap__SM_01_32_32_CSRLoadFromFile, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_CSRLoadFromFile(self, filename)"},
	 { (char *)"_SM_01_32_32_binarySaveToFile", (PyCFunction) _wrap__SM_01_32_32_binarySaveToFile, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_binarySaveToFile(self, filename)"},
	 { (char *)"_SM_01_32_32_binaryLoadFromFile", (PyCFunction) _wrap__SM_01_32_32_binaryLoadFromFile, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_binaryLoadFromFile(self, filename)"},
	 { (char *)"_SM_01_32_32_write", _wrap__SM_01_32_32_write, METH_VARARGS, (char *)"\n"
		"write(proto)\n"
		"_SM_01_32_32_write(self, pyBuilder)\n"
		""},
	 { (char *)"_SM_01_32_32_read", _wrap__SM_01_32_32_read, METH_VARARGS, (char *)"\n"
		"read(proto)\n"
		"_SM_01_32_32_read(self, pyReader)\n"
		""},
	 { (char *)"_SM_01_32_32_fromSparseVector", (PyCFunction) _wrap__SM_01_32_32_fromSparseVector, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_fromSparseVector(self, nrows, ncols, py_x, offset=0)"},
	 { (char *)"_SM_01_32_32_toSparseVector", (PyCFunction) _wrap__SM_01_32_32_toSparseVector, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_toSparseVector(self, offset=0) -> PyObject *"},
	 { (char *)"_SM_01_32_32_getRow", (PyCFunction) _wrap__SM_01_32_32_getRow, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_getRow(self, row) -> PyObject *"},
	 { (char *)"_SM_01_32_32_rowFromDense", (PyCFunction) _wrap__SM_01_32_32_rowFromDense, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_rowFromDense(self, row, py_x)"},
	 { (char *)"_SM_01_32_32_rowToDense", (PyCFunction) _wrap__SM_01_32_32_rowToDense, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_rowToDense(self, row) -> PyObject *"},
	 { (char *)"_SM_01_32_32_rightVecSumAtNZ", (PyCFunction) _wrap__SM_01_32_32_rightVecSumAtNZ, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_rightVecSumAtNZ(self, py_x) -> PyObject *"},
	 { (char *)"_SM_01_32_32_rightVecSumAtNZ_fast", (PyCFunction) _wrap__SM_01_32_32_rightVecSumAtNZ_fast, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_rightVecSumAtNZ_fast(self, py_x, py_y)"},
	 { (char *)"_SM_01_32_32_leftVecSumAtNZ", (PyCFunction) _wrap__SM_01_32_32_leftVecSumAtNZ, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_leftVecSumAtNZ(self, py_x) -> PyObject *"},
	 { (char *)"_SM_01_32_32_leftVecSumAtNZ_fast", (PyCFunction) _wrap__SM_01_32_32_leftVecSumAtNZ_fast, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_leftVecSumAtNZ_fast(self, py_x, py_y)"},
	 { (char *)"_SM_01_32_32_rightDenseMatMaxAtNZ", (PyCFunction) _wrap__SM_01_32_32_rightDenseMatMaxAtNZ, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_rightDenseMatMaxAtNZ(self, mIn) -> PyObject *"},
	 { (char *)"_SM_01_32_32_leftDenseMatSumAtNZ", (PyCFunction) _wrap__SM_01_32_32_leftDenseMatSumAtNZ, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_leftDenseMatSumAtNZ(self, mIn) -> PyObject *"},
	 { (char *)"_SM_01_32_32_leftDenseMatMaxAtNZ", (PyCFunction) _wrap__SM_01_32_32_leftDenseMatMaxAtNZ, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_leftDenseMatMaxAtNZ(self, mIn) -> PyObject *"},
	 { (char *)"_SM_01_32_32_minHammingDistance", (PyCFunction) _wrap__SM_01_32_32_minHammingDistance, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_minHammingDistance(self, py_x) -> PyObject *"},
	 { (char *)"_SM_01_32_32_firstRowCloserThan", (PyCFunction) _wrap__SM_01_32_32_firstRowCloserThan, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_firstRowCloserThan(self, py_x, distance) -> PyObject *"},
	 { (char *)"_SM_01_32_32_firstRowCloserThan_dense", (PyCFunction) _wrap__SM_01_32_32_firstRowCloserThan_dense, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_firstRowCloserThan_dense(self, py_x, distance) -> PyObject *"},
	 { (char *)"_SM_01_32_32_vecMaxProd", (PyCFunction) _wrap__SM_01_32_32_vecMaxProd, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_vecMaxProd(self, py_x) -> PyObject *"},
	 { (char *)"_SM_01_32_32_rightVecArgMaxAtNZ", (PyCFunction) _wrap__SM_01_32_32_rightVecArgMaxAtNZ, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32_rightVecArgMaxAtNZ(self, py_x) -> PyObject *"},
	 { (char *)"_SM_01_32_32___eq__", (PyCFunction) _wrap__SM_01_32_32___eq__, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32___eq__(self, other) -> bool"},
	 { (char *)"_SM_01_32_32___ne__", (PyCFunction) _wrap__SM_01_32_32___ne__, METH_VARARGS | METH_KEYWORDS, (char *)"_SM_01_32_32___ne__(self, other) -> bool"},
	 { (char *)"_SM_01_32_32_swigregister", _SM_01_32_32_swigregister, METH_VARARGS, NULL},
	 { (char *)"kthroot_product", (PyCFunction) _wrap_kthroot_product, METH_VARARGS | METH_KEYWORDS, (char *)"kthroot_product(sm, segment_size, xIn, threshold) -> PyObject *"},
	 { (char *)"sparseRightVecProd", (PyCFunction) _wrap_sparseRightVecProd, METH_VARARGS | METH_KEYWORDS, (char *)"sparseRightVecProd(a, m, n, x) -> PyObject *"},
	 { (char *)"isZero_01", (PyCFunction) _wrap_isZero_01, METH_VARARGS | METH_KEYWORDS, (char *)"isZero_01(py_x) -> bool"},
	 { (char *)"dense_vector_sum", (PyCFunction) _wrap_dense_vector_sum, METH_VARARGS | METH_KEYWORDS, (char *)"dense_vector_sum(py_x) -> nupic::Real32"},
	 { (char *)"binarize_with_threshold", (PyCFunction) _wrap_binarize_with_threshold, METH_VARARGS | METH_KEYWORDS, (char *)"binarize_with_threshold(threshold, py_x) -> PyObject *"},
	 { (char *)"nonZeroRowsIndicator_01", (PyCFunction) _wrap_nonZeroRowsIndicator_01, METH_VARARGS | METH_KEYWORDS, (char *)"nonZeroRowsIndicator_01(nrows, ncols, py_x) -> PyObject *"},
	 { (char *)"nonZeroColsIndicator_01", (PyCFunction) _wrap_nonZeroColsIndicator_01, METH_VARARGS | METH_KEYWORDS, (char *)"nonZeroColsIndicator_01(nrows, ncols, py_x) -> PyObject *"},
	 { (char *)"nNonZeroRows_01", (PyCFunction) _wrap_nNonZeroRows_01, METH_VARARGS | METH_KEYWORDS, (char *)"nNonZeroRows_01(nrows, ncols, py_x) -> nupic::UInt32"},
	 { (char *)"nNonZeroCols_01", (PyCFunction) _wrap_nNonZeroCols_01, METH_VARARGS | METH_KEYWORDS, (char *)"nNonZeroCols_01(nrows, ncols, py_x) -> nupic::UInt32"},
	 { (char *)"matrix_entropy", (PyCFunction) _wrap_matrix_entropy, METH_VARARGS | METH_KEYWORDS, (char *)"matrix_entropy(sm, s=1.0) -> PyObject *"},
	 { (char *)"smoothVecMaxProd", (PyCFunction) _wrap_smoothVecMaxProd, METH_VARARGS | METH_KEYWORDS, (char *)"smoothVecMaxProd(sm, k, xIn) -> PyObject *"},
	 { (char *)"smoothVecArgMaxProd", (PyCFunction) _wrap_smoothVecArgMaxProd, METH_VARARGS | METH_KEYWORDS, (char *)"smoothVecArgMaxProd(sm, k, xIn) -> PyObject *"},
	 { (char *)"LBP_piPrime", (PyCFunction) _wrap_LBP_piPrime, METH_VARARGS | METH_KEYWORDS, (char *)"LBP_piPrime(mat, min_floor=0)"},
	 { (char *)"SM_subtractNoAlloc", (PyCFunction) _wrap_SM_subtractNoAlloc, METH_VARARGS | METH_KEYWORDS, (char *)"SM_subtractNoAlloc(A, B, min_floor=0)"},
	 { (char *)"SM_assignNoAlloc", (PyCFunction) _wrap_SM_assignNoAlloc, METH_VARARGS | METH_KEYWORDS, (char *)"SM_assignNoAlloc(A, B)"},
	 { (char *)"SM_assignNoAllocFromBinary", (PyCFunction) _wrap_SM_assignNoAllocFromBinary, METH_VARARGS | METH_KEYWORDS, (char *)"SM_assignNoAllocFromBinary(A, B)"},
	 { (char *)"SM_addConstantOnNonZeros", (PyCFunction) _wrap_SM_addConstantOnNonZeros, METH_VARARGS | METH_KEYWORDS, (char *)"SM_addConstantOnNonZeros(A, B, cval)"},
	 { (char *)"SM_logSumNoAlloc", (PyCFunction) _wrap_SM_logSumNoAlloc, METH_VARARGS | METH_KEYWORDS, (char *)"SM_logSumNoAlloc(A, B, min_floor=0)"},
	 { (char *)"SM_logAddValNoAlloc", (PyCFunction) _wrap_SM_logAddValNoAlloc, METH_VARARGS | METH_KEYWORDS, (char *)"SM_logAddValNoAlloc(A, val, min_floor=0)"},
	 { (char *)"SM_logDiffNoAlloc", (PyCFunction) _wrap_SM_logDiffNoAlloc, METH_VARARGS | METH_KEYWORDS, (char *)"SM_logDiffNoAlloc(A, B, min_floor=0)"},
	 { (char *)"SM_addToNZOnly", (PyCFunction) _wrap_SM_addToNZOnly, METH_VARARGS | METH_KEYWORDS, (char *)"SM_addToNZOnly(A, v, min_floor=0)"},
	 { (char *)"SM_addToNZDownCols", (PyCFunction) _wrap_SM_addToNZDownCols, METH_VARARGS | METH_KEYWORDS, (char *)"SM_addToNZDownCols(A, py_x, min_floor=0)"},
	 { (char *)"SM_addToNZAcrossRows", (PyCFunction) _wrap_SM_addToNZAcrossRows, METH_VARARGS | METH_KEYWORDS, (char *)"SM_addToNZAcrossRows(A, py_x, min_floor=0)"},
	 { (char *)"count_gt", (PyCFunction) _wrap_count_gt, METH_VARARGS | METH_KEYWORDS, (char *)"count_gt(py_x, threshold) -> nupic::UInt32"},
	 { (char *)"count_gte", (PyCFunction) _wrap_count_gte, METH_VARARGS | METH_KEYWORDS, (char *)"count_gte(py_x, threshold) -> nupic::UInt32"},
	 { (char *)"count_lt", (PyCFunction) _wrap_count_lt, METH_VARARGS | METH_KEYWORDS, (char *)"count_lt(py_x, threshold) -> nupic::UInt32"},
	 { (char *)"partialArgsort", (PyCFunction) _wrap_partialArgsort, METH_VARARGS | METH_KEYWORDS, (char *)"partialArgsort(k, py_x, py_r, direction=-1)"},
	 { (char *)"positiveLearningPartialArgsort", (PyCFunction) _wrap_positiveLearningPartialArgsort, METH_VARARGS | METH_KEYWORDS, (char *)"positiveLearningPartialArgsort(k, py_x, py_r, rng, real_random=False)"},
	 { (char *)"logicalAnd", (PyCFunction) _wrap_logicalAnd, METH_VARARGS | METH_KEYWORDS, (char *)"logicalAnd(py_x, py_y) -> PyObject *"},
	 { (char *)"logicalAnd2", (PyCFunction) _wrap_logicalAnd2, METH_VARARGS | METH_KEYWORDS, (char *)"logicalAnd2(py_x, py_y)"},
	 { (char *)"new__NearestNeighbor32", _wrap_new__NearestNeighbor32, METH_VARARGS, (char *)"\n"
		"_NearestNeighbor32()\n"
		"_NearestNeighbor32(nrows, ncols)\n"
		"_NearestNeighbor32(inStream)\n"
		"new__NearestNeighbor32(other) -> _NearestNeighbor32\n"
		""},
	 { (char *)"_NearestNeighbor32_stddev__set", _wrap__NearestNeighbor32_stddev__set, METH_VARARGS, (char *)"_NearestNeighbor32_stddev__set(self, stddev_)"},
	 { (char *)"_NearestNeighbor32_stddev__get", (PyCFunction)_wrap__NearestNeighbor32_stddev__get, METH_O, (char *)"_NearestNeighbor32_stddev__get(self) -> FloatVector"},
	 { (char *)"_NearestNeighbor32_rowDist", (PyCFunction) _wrap__NearestNeighbor32_rowDist, METH_VARARGS | METH_KEYWORDS, (char *)"_NearestNeighbor32_rowDist(self, row, xIn) -> nupic::Real"},
	 { (char *)"_NearestNeighbor32_vecLpDist", (PyCFunction) _wrap__NearestNeighbor32_vecLpDist, METH_VARARGS | METH_KEYWORDS, (char *)"_NearestNeighbor32_vecLpDist(self, p, xIn, take_root=True) -> PyObject *"},
	 { (char *)"_NearestNeighbor32_LpNearest", (PyCFunction) _wrap__NearestNeighbor32_LpNearest, METH_VARARGS | METH_KEYWORDS, (char *)"_NearestNeighbor32_LpNearest(self, p, row, k=1, take_root=True) -> PyObject *"},
	 { (char *)"_NearestNeighbor32_closestLp_w", (PyCFunction) _wrap__NearestNeighbor32_closestLp_w, METH_VARARGS | METH_KEYWORDS, (char *)"_NearestNeighbor32_closestLp_w(self, p, row) -> PyObject *"},
	 { (char *)"_NearestNeighbor32_closestDot", (PyCFunction) _wrap__NearestNeighbor32_closestDot, METH_VARARGS | METH_KEYWORDS, (char *)"_NearestNeighbor32_closestDot(self, row) -> PyObject *"},
	 { (char *)"_NearestNeighbor32_projLpNearest", (PyCFunction) _wrap__NearestNeighbor32_projLpNearest, METH_VARARGS | METH_KEYWORDS, (char *)"_NearestNeighbor32_projLpNearest(self, p, py_x, k=1, take_root=False) -> PyObject *"},
	 { (char *)"_NearestNeighbor32_projRbf", (PyCFunction) _wrap__NearestNeighbor32_projRbf, METH_VARARGS | METH_KEYWORDS, (char *)"_NearestNeighbor32_projRbf(self, p, k, py_x) -> PyObject *"},
	 { (char *)"delete__NearestNeighbor32", (PyCFunction)_wrap_delete__NearestNeighbor32, METH_O, (char *)"delete__NearestNeighbor32(self)"},
	 { (char *)"_NearestNeighbor32_swigregister", _NearestNeighbor32_swigregister, METH_VARARGS, NULL},
	 { (char *)"min_score_per_category", (PyCFunction) _wrap_min_score_per_category, METH_VARARGS | METH_KEYWORDS, (char *)"min_score_per_category(maxCategoryIdx, c_py, d_py) -> PyObject *"},
	 { (char *)"l2_norm", (PyCFunction) _wrap_l2_norm, METH_VARARGS | METH_KEYWORDS, (char *)"l2_norm(py_x) -> nupic::Real32"},
	 { (char *)"_Gaussian2D_32_c_x_set", _wrap__Gaussian2D_32_c_x_set, METH_VARARGS, (char *)"_Gaussian2D_32_c_x_set(self, c_x)"},
	 { (char *)"_Gaussian2D_32_c_x_get", (PyCFunction)_wrap__Gaussian2D_32_c_x_get, METH_O, (char *)"_Gaussian2D_32_c_x_get(self) -> float"},
	 { (char *)"_Gaussian2D_32_c_y_set", _wrap__Gaussian2D_32_c_y_set, METH_VARARGS, (char *)"_Gaussian2D_32_c_y_set(self, c_y)"},
	 { (char *)"_Gaussian2D_32_c_y_get", (PyCFunction)_wrap__Gaussian2D_32_c_y_get, METH_O, (char *)"_Gaussian2D_32_c_y_get(self) -> float"},
	 { (char *)"_Gaussian2D_32_s00_set", _wrap__Gaussian2D_32_s00_set, METH_VARARGS, (char *)"_Gaussian2D_32_s00_set(self, s00)"},
	 { (char *)"_Gaussian2D_32_s00_get", (PyCFunction)_wrap__Gaussian2D_32_s00_get, METH_O, (char *)"_Gaussian2D_32_s00_get(self) -> float"},
	 { (char *)"_Gaussian2D_32_s01_set", _wrap__Gaussian2D_32_s01_set, METH_VARARGS, (char *)"_Gaussian2D_32_s01_set(self, s01)"},
	 { (char *)"_Gaussian2D_32_s01_get", (PyCFunction)_wrap__Gaussian2D_32_s01_get, METH_O, (char *)"_Gaussian2D_32_s01_get(self) -> float"},
	 { (char *)"_Gaussian2D_32_s10_set", _wrap__Gaussian2D_32_s10_set, METH_VARARGS, (char *)"_Gaussian2D_32_s10_set(self, s10)"},
	 { (char *)"_Gaussian2D_32_s10_get", (PyCFunction)_wrap__Gaussian2D_32_s10_get, METH_O, (char *)"_Gaussian2D_32_s10_get(self) -> float"},
	 { (char *)"_Gaussian2D_32_s11_set", _wrap__Gaussian2D_32_s11_set, METH_VARARGS, (char *)"_Gaussian2D_32_s11_set(self, s11)"},
	 { (char *)"_Gaussian2D_32_s11_get", (PyCFunction)_wrap__Gaussian2D_32_s11_get, METH_O, (char *)"_Gaussian2D_32_s11_get(self) -> float"},
	 { (char *)"_Gaussian2D_32_s2_set", _wrap__Gaussian2D_32_s2_set, METH_VARARGS, (char *)"_Gaussian2D_32_s2_set(self, s2)"},
	 { (char *)"_Gaussian2D_32_s2_get", (PyCFunction)_wrap__Gaussian2D_32_s2_get, METH_O, (char *)"_Gaussian2D_32_s2_get(self) -> float"},
	 { (char *)"_Gaussian2D_32_k1_set", _wrap__Gaussian2D_32_k1_set, METH_VARARGS, (char *)"_Gaussian2D_32_k1_set(self, k1)"},
	 { (char *)"_Gaussian2D_32_k1_get", (PyCFunction)_wrap__Gaussian2D_32_k1_get, METH_O, (char *)"_Gaussian2D_32_k1_get(self) -> float"},
	 { (char *)"new__Gaussian2D_32", _wrap_new__Gaussian2D_32, METH_VARARGS, (char *)"\n"
		"_Gaussian2D_32(c_x_, c_y_, s00_, s01_, s10_, s11_)\n"
		"new__Gaussian2D_32(o) -> _Gaussian2D_32\n"
		""},
	 { (char *)"_Gaussian2D_32___call__", (PyCFunction) _wrap__Gaussian2D_32___call__, METH_VARARGS | METH_KEYWORDS, (char *)"_Gaussian2D_32___call__(self, x, y) -> float"},
	 { (char *)"_Gaussian2D_32_eval", (PyCFunction) _wrap__Gaussian2D_32_eval, METH_VARARGS | METH_KEYWORDS, (char *)"_Gaussian2D_32_eval(self, x, y) -> nupic::Real32"},
	 { (char *)"delete__Gaussian2D_32", (PyCFunction)_wrap_delete__Gaussian2D_32, METH_O, (char *)"delete__Gaussian2D_32(self)"},
	 { (char *)"_Gaussian2D_32_swigregister", _Gaussian2D_32_swigregister, METH_VARARGS, NULL},
	 { (char *)"new__Set", _wrap_new__Set, METH_VARARGS, (char *)"\n"
		"_Set()\n"
		"_Set(_m, _n, ss)\n"
		"new__Set(o) -> _Set\n"
		""},
	 { (char *)"_Set_n_elements", (PyCFunction)_wrap__Set_n_elements, METH_O, (char *)"_Set_n_elements(self) -> unsigned int"},
	 { (char *)"_Set_max_index", (PyCFunction)_wrap__Set_max_index, METH_O, (char *)"_Set_max_index(self) -> unsigned int"},
	 { (char *)"_Set_n_bytes", (PyCFunction)_wrap__Set_n_bytes, METH_O, (char *)"_Set_n_bytes(self) -> unsigned int"},
	 { (char *)"_Set_construct", _wrap__Set_construct, METH_VARARGS, (char *)"\n"
		"construct(_m, _n, ss)\n"
		"_Set_construct(self, m, py_a)\n"
		""},
	 { (char *)"_Set_intersection", _wrap__Set_intersection, METH_VARARGS, (char *)"\n"
		"intersection(n2, s2, r) -> unsigned int\n"
		"_Set_intersection(self, py_s2, py_r) -> nupic::UInt32\n"
		""},
	 { (char *)"delete__Set", (PyCFunction)_wrap_delete__Set, METH_O, (char *)"delete__Set(self)"},
	 { (char *)"_Set_swigregister", _Set_swigregister, METH_VARARGS, NULL},
	 { (char *)"new_PyTensorIndex", _wrap_new_PyTensorIndex, METH_VARARGS, (char *)"\n"
		"PyTensorIndex()\n"
		"PyTensorIndex(x)\n"
		"PyTensorIndex(i)\n"
		"PyTensorIndex(i, j)\n"
		"PyTensorIndex(i, j, k)\n"
		"PyTensorIndex(i, j, k, l)\n"
		"PyTensorIndex(i, j, k, l, m)\n"
		"PyTensorIndex(i, j, k, l, m, n)\n"
		"PyTensorIndex(i)\n"
		"new_PyTensorIndex(i1, i2) -> PyTensorIndex\n"
		""},
	 { (char *)"PyTensorIndex_size", (PyCFunction)_wrap_PyTensorIndex_size, METH_O, (char *)"PyTensorIndex_size(self) -> nupic::UInt32"},
	 { (char *)"PyTensorIndex___getitem__", (PyCFunction) _wrap_PyTensorIndex___getitem__, METH_VARARGS | METH_KEYWORDS, (char *)"PyTensorIndex___getitem__(self, i) -> nupic::UInt32"},
	 { (char *)"PyTensorIndex___setitem__", (PyCFunction) _wrap_PyTensorIndex___setitem__, METH_VARARGS | METH_KEYWORDS, (char *)"PyTensorIndex___setitem__(self, i, d)"},
	 { (char *)"PyTensorIndex___len__", (PyCFunction)_wrap_PyTensorIndex___len__, METH_O, (char *)"PyTensorIndex___len__(self) -> nupic::UInt32"},
	 { (char *)"PyTensorIndex_begin", _wrap_PyTensorIndex_begin, METH_VARARGS, (char *)"\n"
		"begin() -> nupic::UInt32 const\n"
		"PyTensorIndex_begin(self) -> nupic::UInt32 *\n"
		""},
	 { (char *)"PyTensorIndex_end", _wrap_PyTensorIndex_end, METH_VARARGS, (char *)"\n"
		"end() -> nupic::UInt32 const\n"
		"PyTensorIndex_end(self) -> nupic::UInt32 *\n"
		""},
	 { (char *)"PyTensorIndex___lt__", (PyCFunction) _wrap_PyTensorIndex___lt__, METH_VARARGS | METH_KEYWORDS, (char *)"PyTensorIndex___lt__(self, j) -> bool"},
	 { (char *)"PyTensorIndex___gt__", (PyCFunction) _wrap_PyTensorIndex___gt__, METH_VARARGS | METH_KEYWORDS, (char *)"PyTensorIndex___gt__(self, j) -> bool"},
	 { (char *)"PyTensorIndex___eq__", _wrap_PyTensorIndex___eq__, METH_VARARGS, (char *)"\n"
		"__eq__(j) -> bool\n"
		"PyTensorIndex___eq__(self, j) -> bool\n"
		""},
	 { (char *)"PyTensorIndex___ne__", _wrap_PyTensorIndex___ne__, METH_VARARGS, (char *)"\n"
		"__ne__(j) -> bool\n"
		"PyTensorIndex___ne__(self, j) -> bool\n"
		""},
	 { (char *)"PyTensorIndex___str__", (PyCFunction)_wrap_PyTensorIndex___str__, METH_O, (char *)"PyTensorIndex___str__(self) -> std::string"},
	 { (char *)"PyTensorIndex___getslice__", (PyCFunction) _wrap_PyTensorIndex___getslice__, METH_VARARGS | METH_KEYWORDS, (char *)"PyTensorIndex___getslice__(self, i, j) -> VectorOfUInt32"},
	 { (char *)"PyTensorIndex___setslice__", (PyCFunction) _wrap_PyTensorIndex___setslice__, METH_VARARGS | METH_KEYWORDS, (char *)"PyTensorIndex___setslice__(self, i, j, x)"},
	 { (char *)"PyTensorIndex_asTuple", (PyCFunction)_wrap_PyTensorIndex_asTuple, METH_O, (char *)"PyTensorIndex_asTuple(self) -> VectorOfUInt32"},
	 { (char *)"PyTensorIndex___getstate__", (PyCFunction)_wrap_PyTensorIndex___getstate__, METH_O, (char *)"PyTensorIndex___getstate__(self) -> VectorOfUInt32"},
	 { (char *)"delete_PyTensorIndex", (PyCFunction)_wrap_delete_PyTensorIndex, METH_O, (char *)"delete_PyTensorIndex(self)"},
	 { (char *)"PyTensorIndex_swigregister", PyTensorIndex_swigregister, METH_VARARGS, NULL},
	 { (char *)"concatenate", (PyCFunction) _wrap_concatenate, METH_VARARGS | METH_KEYWORDS, (char *)"concatenate(i1, i2) -> PyTensorIndex"},
	 { (char *)"new_PyDomain", _wrap_new_PyDomain, METH_VARARGS, (char *)"\n"
		"PyDomain(lowerHalfSpace)\n"
		"new_PyDomain(lower, upper) -> PyDomain\n"
		""},
	 { (char *)"PyDomain_getLowerBound", (PyCFunction)_wrap_PyDomain_getLowerBound, METH_O, (char *)"PyDomain_getLowerBound(self) -> PyTensorIndex"},
	 { (char *)"PyDomain_getUpperBound", (PyCFunction)_wrap_PyDomain_getUpperBound, METH_O, (char *)"PyDomain_getUpperBound(self) -> PyTensorIndex"},
	 { (char *)"PyDomain___getitem__", (PyCFunction) _wrap_PyDomain___getitem__, METH_VARARGS | METH_KEYWORDS, (char *)"PyDomain___getitem__(self, i) -> VectorOfUInt32"},
	 { (char *)"PyDomain_getDimensions", (PyCFunction)_wrap_PyDomain_getDimensions, METH_O, (char *)"PyDomain_getDimensions(self) -> PyTensorIndex"},
	 { (char *)"PyDomain_getNumOpenDims", (PyCFunction)_wrap_PyDomain_getNumOpenDims, METH_O, (char *)"PyDomain_getNumOpenDims(self) -> nupic::UInt32"},
	 { (char *)"PyDomain_getOpenDimensions", (PyCFunction)_wrap_PyDomain_getOpenDimensions, METH_O, (char *)"PyDomain_getOpenDimensions(self) -> PyTensorIndex"},
	 { (char *)"PyDomain_getSliceBounds", (PyCFunction)_wrap_PyDomain_getSliceBounds, METH_O, (char *)"PyDomain_getSliceBounds(self) -> PyTensorIndex"},
	 { (char *)"PyDomain_doesInclude", (PyCFunction) _wrap_PyDomain_doesInclude, METH_VARARGS | METH_KEYWORDS, (char *)"PyDomain_doesInclude(self, x) -> bool"},
	 { (char *)"PyDomain___str__", (PyCFunction)_wrap_PyDomain___str__, METH_O, (char *)"PyDomain___str__(self) -> std::string"},
	 { (char *)"delete_PyDomain", (PyCFunction)_wrap_delete_PyDomain, METH_O, (char *)"delete_PyDomain(self)"},
	 { (char *)"PyDomain_swigregister", PyDomain_swigregister, METH_VARARGS, NULL},
	 { (char *)"new_PySparseTensor", _wrap_new_PySparseTensor, METH_VARARGS, (char *)"\n"
		"PySparseTensor(state)\n"
		"PySparseTensor(bounds)\n"
		"PySparseTensor(bounds)\n"
		"new_PySparseTensor(dense) -> PySparseTensor\n"
		""},
	 { (char *)"PySparseTensor_getRank", (PyCFunction)_wrap_PySparseTensor_getRank, METH_O, (char *)"PySparseTensor_getRank(self) -> nupic::UInt32"},
	 { (char *)"PySparseTensor_getBounds", (PyCFunction)_wrap_PySparseTensor_getBounds, METH_O, (char *)"PySparseTensor_getBounds(self) -> PyTensorIndex"},
	 { (char *)"PySparseTensor_getBound", (PyCFunction) _wrap_PySparseTensor_getBound, METH_VARARGS | METH_KEYWORDS, (char *)"PySparseTensor_getBound(self, dim) -> nupic::UInt32"},
	 { (char *)"PySparseTensor_get", _wrap_PySparseTensor_get, METH_VARARGS, (char *)"\n"
		"get(i) -> nupic::Real\n"
		"PySparseTensor_get(self, i) -> nupic::Real\n"
		""},
	 { (char *)"PySparseTensor_set", _wrap_PySparseTensor_set, METH_VARARGS, (char *)"\n"
		"set(i, x)\n"
		"set(i, x)\n"
		"set(i, x)\n"
		"PySparseTensor_set(self, i, x)\n"
		""},
	 { (char *)"PySparseTensor_getNNonZeros", (PyCFunction)_wrap_PySparseTensor_getNNonZeros, METH_O, (char *)"PySparseTensor_getNNonZeros(self) -> nupic::UInt32"},
	 { (char *)"PySparseTensor_nNonZeros", (PyCFunction)_wrap_PySparseTensor_nNonZeros, METH_O, (char *)"PySparseTensor_nNonZeros(self) -> nupic::UInt32"},
	 { (char *)"PySparseTensor_reshape", (PyCFunction) _wrap_PySparseTensor_reshape, METH_VARARGS | METH_KEYWORDS, (char *)"PySparseTensor_reshape(self, dims) -> PySparseTensor"},
	 { (char *)"PySparseTensor_resize", _wrap_PySparseTensor_resize, METH_VARARGS, (char *)"\n"
		"resize(dims)\n"
		"PySparseTensor_resize(self, dims)\n"
		""},
	 { (char *)"PySparseTensor_extract", (PyCFunction) _wrap_PySparseTensor_extract, METH_VARARGS | METH_KEYWORDS, (char *)"PySparseTensor_extract(self, dim, ind) -> PySparseTensor"},
	 { (char *)"PySparseTensor_reduce", (PyCFunction) _wrap_PySparseTensor_reduce, METH_VARARGS | METH_KEYWORDS, (char *)"PySparseTensor_reduce(self, dim, ind)"},
	 { (char *)"PySparseTensor_getSlice", (PyCFunction) _wrap_PySparseTensor_getSlice, METH_VARARGS | METH_KEYWORDS, (char *)"PySparseTensor_getSlice(self, range) -> PySparseTensor"},
	 { (char *)"PySparseTensor_setSlice", (PyCFunction) _wrap_PySparseTensor_setSlice, METH_VARARGS | METH_KEYWORDS, (char *)"PySparseTensor_setSlice(self, range, slice)"},
	 { (char *)"PySparseTensor_setZero", (PyCFunction) _wrap_PySparseTensor_setZero, METH_VARARGS | METH_KEYWORDS, (char *)"PySparseTensor_setZero(self, range)"},
	 { (char *)"PySparseTensor_addSlice", (PyCFunction) _wrap_PySparseTensor_addSlice, METH_VARARGS | METH_KEYWORDS, (char *)"PySparseTensor_addSlice(self, which, src, dst)"},
	 { (char *)"PySparseTensor_factorMultiply", _wrap_PySparseTensor_factorMultiply, METH_VARARGS, (char *)"\n"
		"factorMultiply(dims, B) -> PySparseTensor\n"
		"PySparseTensor_factorMultiply(self, dims, B) -> PySparseTensor\n"
		""},
	 { (char *)"PySparseTensor_outerProduct", (PyCFunction) _wrap_PySparseTensor_outerProduct, METH_VARARGS | METH_KEYWORDS, (char *)"PySparseTensor_outerProduct(self, B) -> PySparseTensor"},
	 { (char *)"PySparseTensor_innerProduct", (PyCFunction) _wrap_PySparseTensor_innerProduct, METH_VARARGS | METH_KEYWORDS, (char *)"PySparseTensor_innerProduct(self, dim1, dim2, B) -> PySparseTensor"},
	 { (char *)"PySparseTensor___add__", (PyCFunction) _wrap_PySparseTensor___add__, METH_VARARGS | METH_KEYWORDS, (char *)"PySparseTensor___add__(self, B) -> PySparseTensor"},
	 { (char *)"PySparseTensor___sub__", (PyCFunction) _wrap_PySparseTensor___sub__, METH_VARARGS | METH_KEYWORDS, (char *)"PySparseTensor___sub__(self, B) -> PySparseTensor"},
	 { (char *)"PySparseTensor_factorAdd", _wrap_PySparseTensor_factorAdd, METH_VARARGS, (char *)"\n"
		"factorAdd(dims, B) -> PySparseTensor\n"
		"PySparseTensor_factorAdd(self, dims, B) -> PySparseTensor\n"
		""},
	 { (char *)"PySparseTensor_getComplementBounds", (PyCFunction) _wrap_PySparseTensor_getComplementBounds, METH_VARARGS | METH_KEYWORDS, (char *)"PySparseTensor_getComplementBounds(self, dims) -> PySparseTensor"},
	 { (char *)"PySparseTensor___mul__", (PyCFunction) _wrap_PySparseTensor___mul__, METH_VARARGS | METH_KEYWORDS, (char *)"PySparseTensor___mul__(self, x) -> PySparseTensor"},
	 { (char *)"PySparseTensor___neg__", (PyCFunction)_wrap_PySparseTensor___neg__, METH_O, (char *)"PySparseTensor___neg__(self) -> PySparseTensor"},
	 { (char *)"PySparseTensor_marginalize", _wrap_PySparseTensor_marginalize, METH_VARARGS, (char *)"\n"
		"marginalize() -> double\n"
		"marginalize(dims) -> PySparseTensor\n"
		"PySparseTensor_marginalize(self, dims) -> PySparseTensor\n"
		""},
	 { (char *)"PySparseTensor_argmax", (PyCFunction)_wrap_PySparseTensor_argmax, METH_O, (char *)"PySparseTensor_argmax(self) -> PyTensorIndex"},
	 { (char *)"PySparseTensor_max", _wrap_PySparseTensor_max, METH_VARARGS, (char *)"\n"
		"max() -> nupic::Real\n"
		"max(dims) -> PySparseTensor\n"
		"PySparseTensor_max(self, dims) -> PySparseTensor\n"
		""},
	 { (char *)"PySparseTensor_tolist", (PyCFunction)_wrap_PySparseTensor_tolist, METH_O, (char *)"PySparseTensor_tolist(self) -> PyObject *"},
	 { (char *)"PySparseTensor___eq__", (PyCFunction) _wrap_PySparseTensor___eq__, METH_VARARGS | METH_KEYWORDS, (char *)"PySparseTensor___eq__(self, B) -> bool"},
	 { (char *)"PySparseTensor___ne__", (PyCFunction) _wrap_PySparseTensor___ne__, METH_VARARGS | METH_KEYWORDS, (char *)"PySparseTensor___ne__(self, B) -> bool"},
	 { (char *)"PySparseTensor_toDense", (PyCFunction)_wrap_PySparseTensor_toDense, METH_O, (char *)"PySparseTensor_toDense(self) -> PyObject *"},
	 { (char *)"PySparseTensor___str__", (PyCFunction)_wrap_PySparseTensor___str__, METH_O, (char *)"PySparseTensor___str__(self) -> PyObject *"},
	 { (char *)"PySparseTensor___getstate__", (PyCFunction)_wrap_PySparseTensor___getstate__, METH_O, (char *)"PySparseTensor___getstate__(self) -> std::string"},
	 { (char *)"PySparseTensor_copy", (PyCFunction)_wrap_PySparseTensor_copy, METH_O, (char *)"PySparseTensor_copy(self) -> PySparseTensor"},
	 { (char *)"delete_PySparseTensor", (PyCFunction)_wrap_delete_PySparseTensor, METH_O, (char *)"delete_PySparseTensor(self)"},
	 { (char *)"PySparseTensor_swigregister", PySparseTensor_swigregister, METH_VARARGS, NULL},
	 { (char *)"lgamma", (PyCFunction) _wrap_lgamma, METH_VARARGS | METH_KEYWORDS, (char *)"lgamma(x) -> nupic::Real64"},
	 { (char *)"digamma", (PyCFunction) _wrap_digamma, METH_VARARGS | METH_KEYWORDS, (char *)"digamma(x) -> nupic::Real64"},
	 { (char *)"beta", (PyCFunction) _wrap_beta, METH_VARARGS | METH_KEYWORDS, (char *)"beta(x, y) -> nupic::Real64"},
	 { (char *)"erf", (PyCFunction) _wrap_erf, METH_VARARGS | METH_KEYWORDS, (char *)"erf(x) -> nupic::Real64"},
	 { (char *)"nearlyZeroRange", (PyCFunction) _wrap_nearlyZeroRange, METH_VARARGS | METH_KEYWORDS, (char *)"nearlyZeroRange(py_x, eps=Epsilon) -> bool"},
	 { (char *)"nearlyEqualRange", (PyCFunction) _wrap_nearlyEqualRange, METH_VARARGS | METH_KEYWORDS, (char *)"nearlyEqualRange(py_x, py_y, eps=Epsilon) -> bool"},
	 { (char *)"positive_less_than", (PyCFunction) _wrap_positive_less_than, METH_VARARGS | METH_KEYWORDS, (char *)"positive_less_than(py_x, eps=Epsilon) -> bool"},
	 { (char *)"winnerTakesAll_3", (PyCFunction) _wrap_winnerTakesAll_3, METH_VARARGS | METH_KEYWORDS, (char *)"winnerTakesAll_3(k, seg_size, py_x) -> PyObject *"},
	 { (char *)"fact", (PyCFunction) _wrap_fact, METH_VARARGS | METH_KEYWORDS, (char *)"fact(n) -> double"},
	 { (char *)"lfact", (PyCFunction) _wrap_lfact, METH_VARARGS | METH_KEYWORDS, (char *)"lfact(n) -> double"},
	 { (char *)"binomial", (PyCFunction) _wrap_binomial, METH_VARARGS | METH_KEYWORDS, (char *)"binomial(n, k) -> double"},
	 { (char *)"delete_LoggingException", (PyCFunction)_wrap_delete_LoggingException, METH_O, (char *)"delete_LoggingException(self)"},
	 { (char *)"LoggingException_getMessage", (PyCFunction)_wrap_LoggingException_getMessage, METH_O, (char *)"LoggingException_getMessage(self) -> char const *"},
	 { (char *)"LoggingException___lshift__", (PyCFunction) _wrap_LoggingException___lshift__, METH_VARARGS | METH_KEYWORDS, (char *)"LoggingException___lshift__(self, v) -> LoggingException"},
	 { (char *)"new_LoggingException", _wrap_new_LoggingException, METH_VARARGS, (char *)"\n"
		"LoggingException(filename, lineno)\n"
		"new_LoggingException(l) -> LoggingException\n"
		""},
	 { (char *)"LoggingException_swigregister", LoggingException_swigregister, METH_VARARGS, NULL},
	 { (char *)"Random_getSeeder", (PyCFunction)_wrap_Random_getSeeder, METH_NOARGS, (char *)"Random_getSeeder() -> RandomSeedFuncPtr"},
	 { (char *)"new_Random", _wrap_new_Random, METH_VARARGS, (char *)"\n"
		"Random(seed=0)\n"
		"new_Random(arg1) -> Random\n"
		""},
	 { (char *)"delete_Random", (PyCFunction)_wrap_delete_Random, METH_O, (char *)"delete_Random(self)"},
	 { (char *)"Random_getUInt32", (PyCFunction) _wrap_Random_getUInt32, METH_VARARGS | METH_KEYWORDS, (char *)"Random_getUInt32(self, max=MAX32) -> nupic::UInt32"},
	 { (char *)"Random_getUInt64", (PyCFunction) _wrap_Random_getUInt64, METH_VARARGS | METH_KEYWORDS, (char *)"Random_getUInt64(self, max=MAX64) -> nupic::UInt64"},
	 { (char *)"Random_getReal64", (PyCFunction)_wrap_Random_getReal64, METH_O, (char *)"Random_getReal64(self) -> nupic::Real64"},
	 { (char *)"Random___call__", (PyCFunction) _wrap_Random___call__, METH_VARARGS | METH_KEYWORDS, (char *)"Random___call__(self, n=MAX32) -> nupic::UInt32"},
	 { (char *)"Random_getSeed", (PyCFunction)_wrap_Random_getSeed, METH_O, (char *)"Random_getSeed(self) -> nupic::UInt64"},
	 { (char *)"Random_max", (PyCFunction)_wrap_Random_max, METH_O, (char *)"Random_max(self) -> nupic::Random::result_type"},
	 { (char *)"Random_min", (PyCFunction)_wrap_Random_min, METH_O, (char *)"Random_min(self) -> nupic::Random::result_type"},
	 { (char *)"Random_initSeeder", (PyCFunction) _wrap_Random_initSeeder, METH_VARARGS | METH_KEYWORDS, (char *)"Random_initSeeder(r)"},
	 { (char *)"Random_shutdown", (PyCFunction)_wrap_Random_shutdown, METH_NOARGS, (char *)"Random_shutdown()"},
	 { (char *)"Random___getstate__", (PyCFunction)_wrap_Random___getstate__, METH_O, (char *)"Random___getstate__(self) -> std::string"},
	 { (char *)"Random_getState", (PyCFunction)_wrap_Random_getState, METH_O, (char *)"Random_getState(self) -> std::string"},
	 { (char *)"Random_setState", (PyCFunction) _wrap_Random_setState, METH_VARARGS | METH_KEYWORDS, (char *)"Random_setState(self, s)"},
	 { (char *)"Random_setSeed", (PyCFunction) _wrap_Random_setSeed, METH_VARARGS | METH_KEYWORDS, (char *)"Random_setSeed(self, x)"},
	 { (char *)"Random_jumpAhead", (PyCFunction) _wrap_Random_jumpAhead, METH_VARARGS | METH_KEYWORDS, (char *)"Random_jumpAhead(self, n)"},
	 { (char *)"Random_initializeUInt32Array", (PyCFunction) _wrap_Random_initializeUInt32Array, METH_VARARGS | METH_KEYWORDS, (char *)"Random_initializeUInt32Array(self, py_array, max_value)"},
	 { (char *)"Random_initializeReal32Array", (PyCFunction) _wrap_Random_initializeReal32Array, METH_VARARGS | METH_KEYWORDS, (char *)"Random_initializeReal32Array(self, py_array)"},
	 { (char *)"Random_initializeReal32Array_01", (PyCFunction) _wrap_Random_initializeReal32Array_01, METH_VARARGS | METH_KEYWORDS, (char *)"Random_initializeReal32Array_01(self, py_array, proba)"},
	 { (char *)"Random_sample", (PyCFunction) _wrap_Random_sample, METH_VARARGS | METH_KEYWORDS, (char *)"Random_sample(self, population, choices) -> PyObject *"},
	 { (char *)"Random_shuffle", (PyCFunction) _wrap_Random_shuffle, METH_VARARGS | METH_KEYWORDS, (char *)"Random_shuffle(self, obj) -> PyObject *"},
	 { (char *)"Random_write", _wrap_Random_write, METH_VARARGS, (char *)"\n"
		"write(stream)\n"
		"write(proto)\n"
		"Random_write(self, pyBuilder)\n"
		""},
	 { (char *)"Random_read", _wrap_Random_read, METH_VARARGS, (char *)"\n"
		"read(stream)\n"
		"read(proto)\n"
		"Random_read(self, pyReader)\n"
		""},
	 { (char *)"Random_swigregister", Random_swigregister, METH_VARARGS, NULL},
	 { (char *)"__lshift__", (PyCFunction) _wrap___lshift__, METH_VARARGS | METH_KEYWORDS, (char *)"__lshift__(arg1, arg2) -> std::ostream &"},
	 { (char *)"__rshift__", (PyCFunction) _wrap___rshift__, METH_VARARGS | METH_KEYWORDS, (char *)"__rshift__(arg1, arg2) -> std::istream &"},
	 { (char *)"GetRandomSeed", (PyCFunction)_wrap_GetRandomSeed, METH_NOARGS, (char *)"GetRandomSeed() -> NTA_UInt64"},
	 { NULL, NULL, 0, NULL }
};


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

static void *_p_nupic__NearestNeighborT_nupic__SparseMatrixT_nupic__UInt32_nupic__Real32_nupic__Int32_nupic__Real64_nupic__DistanceToZeroT_nupic__Real32_t_t_tTo_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > > *)  ((nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *) x));
}
static void *_p_nupic__Domain2DT_unsigned_int_tTo_p_nupic__DomainT_unsigned_int_t(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((nupic::Domain< unsigned int > *)  ((nupic::Domain2D< unsigned int > *) x));
}
static void *_p_PyDomainTo_p_nupic__DomainT_unsigned_int_t(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((nupic::Domain< unsigned int > *)  ((PyDomain *) x));
}
static swig_type_info _swigt__p_IJV = {"_p_IJV", "IJV *", 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_PyDomain = {"_p_PyDomain", "PyDomain *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_PySparseTensor = {"_p_PySparseTensor", "PySparseTensor *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_PyTensorIndex = {"_p_PyTensorIndex", "PyTensorIndex *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_RandomProto__Builder = {"_p_RandomProto__Builder", "RandomProto::Builder *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_RandomProto__Reader = {"_p_RandomProto__Reader", "RandomProto::Reader *", 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_SparseBinaryMatrixProto__Builder = {"_p_SparseBinaryMatrixProto__Builder", "SparseBinaryMatrixProto::Builder *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_SparseBinaryMatrixProto__Reader = {"_p_SparseBinaryMatrixProto__Reader", "SparseBinaryMatrixProto::Reader *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_SparseMatrixProto__Builder = {"_p_SparseMatrixProto__Builder", "SparseMatrixProto::Builder *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_SparseMatrixProto__Reader = {"_p_SparseMatrixProto__Reader", "SparseMatrixProto::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_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_f___unsigned_long = {"_p_f___unsigned_long", "unsigned long (*)()|RandomSeedFuncPtr", 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::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::const_row_nz_value_iterator|nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::value_type *|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_key_type = {"_p_key_type", "key_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__DistanceToZeroT_float_t = {"_p_nupic__DistanceToZeroT_float_t", "nupic::DistanceToZero< float > *|nupic::DistanceToZero< nupic::Real32 > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__Domain2DT_unsigned_int_t = {"_p_nupic__Domain2DT_unsigned_int_t", "nupic::Domain2D< nupic::UInt32 > *|nupic::Domain2D< unsigned int > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__DomainT_unsigned_int_t = {"_p_nupic__DomainT_unsigned_int_t", "nupic::Domain< nupic::UInt32 > *|nupic::Domain< unsigned int > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__Gaussian2DT_float_t = {"_p_nupic__Gaussian2DT_float_t", "nupic::Gaussian2D< float > *|nupic::Gaussian2D< nupic::Real32 > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__IsNearlyZeroT_nupic__DistanceToZeroT_nupic__Real32_t_t = {"_p_nupic__IsNearlyZeroT_nupic__DistanceToZeroT_nupic__Real32_t_t", "nupic::IsNearlyZero< nupic::DistanceToZero< float > > *|nupic::IsNearlyZero< nupic::DistanceToZero< nupic::Real32 > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__LogDiffApprox = {"_p_nupic__LogDiffApprox", "nupic::LogDiffApprox *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__LogSumApprox = {"_p_nupic__LogSumApprox", "nupic::LogSumApprox *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__LoggingException = {"_p_nupic__LoggingException", "nupic::LoggingException *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__NearestNeighborT_nupic__SparseMatrixT_nupic__UInt32_nupic__Real32_nupic__Int32_nupic__Real64_nupic__DistanceToZeroT_nupic__Real32_t_t_t = {"_p_nupic__NearestNeighborT_nupic__SparseMatrixT_nupic__UInt32_nupic__Real32_nupic__Int32_nupic__Real64_nupic__DistanceToZeroT_nupic__Real32_t_t_t", "nupic::NearestNeighbor< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > > *|nupic::NearestNeighbor< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__Random = {"_p_nupic__Random", "nupic::Random *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__SetT_unsigned_int_unsigned_char_t = {"_p_nupic__SetT_unsigned_int_unsigned_char_t", "nupic::Set< unsigned int,unsigned char > *|nupic::Set< nupic::UInt32 > *|nupic::Set< unsigned int > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t = {"_p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t", "nupic::SparseBinaryMatrix< unsigned int,unsigned int > *|nupic::SparseBinaryMatrix< nupic::UInt32,nupic::UInt32 > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__SparseMatrixAlgorithms = {"_p_nupic__SparseMatrixAlgorithms", "nupic::SparseMatrixAlgorithms *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t = {"_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t", "nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > > *|nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > *|nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::self_type *|nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > > *", 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_p_PyObject = {"_p_p_PyObject", "PyObject **", 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_result_type = {"_p_result_type", "result_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_double_t = {"_p_std__allocatorT_double_t", "std::vector< double >::allocator_type *|std::allocator< double > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__allocatorT_float_t = {"_p_std__allocatorT_float_t", "std::vector< float >::allocator_type *|std::allocator< float > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__allocatorT_int_t = {"_p_std__allocatorT_int_t", "std::vector< int >::allocator_type *|std::allocator< int > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__allocatorT_long_t = {"_p_std__allocatorT_long_t", "std::vector< long >::allocator_type *|std::allocator< long > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t = {"_p_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t", "std::vector< std::map< std::string,std::string > >::allocator_type *|std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t = {"_p_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t", "std::allocator< std::pair< unsigned int,float > > *|std::vector< std::pair< unsigned int,float > >::allocator_type *|std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t = {"_p_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t", "std::vector< std::pair< unsigned int,double > >::allocator_type *|std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > *|std::allocator< std::pair< unsigned int,double > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t = {"_p_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t", "std::allocator< std::pair< unsigned int,unsigned int > > *|std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > *|std::vector< std::pair< unsigned int,unsigned int > >::allocator_type *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__allocatorT_std__pairT_std__string_const_std__string_t_t = {"_p_std__allocatorT_std__pairT_std__string_const_std__string_t_t", "std::map< std::string,std::string >::allocator_type *|std::allocator< std::pair< std::string const,std::string > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__allocatorT_std__pairT_std__string_std__string_t_t = {"_p_std__allocatorT_std__pairT_std__string_std__string_t_t", "std::vector< std::pair< std::string,std::string > >::allocator_type *|std::allocator< std::pair< std::string,std::string > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__allocatorT_std__string_t = {"_p_std__allocatorT_std__string_t", "std::vector< std::string >::allocator_type *|std::list< std::string >::allocator_type *|std::allocator< std::string > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t = {"_p_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t", "std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > *|std::allocator< std::vector< std::pair< unsigned int,unsigned int >,std::allocator< std::pair< unsigned int,unsigned int > > > > *|std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::allocator_type *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__allocatorT_unsigned_int_t = {"_p_std__allocatorT_unsigned_int_t", "std::vector< unsigned int >::allocator_type *|std::allocator< unsigned int > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__allocatorT_unsigned_long_t = {"_p_std__allocatorT_unsigned_long_t", "std::vector< unsigned long >::allocator_type *|std::allocator< unsigned long > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__invalid_argument = {"_p_std__invalid_argument", "std::invalid_argument *", 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__lessT_std__string_t = {"_p_std__lessT_std__string_t", "std::less< std::string > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__listT_std__string_std__allocatorT_std__string_t_t = {"_p_std__listT_std__string_std__allocatorT_std__string_t_t", "std::list< std::string > *|std::list< std::string,std::allocator< std::string > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t = {"_p_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t", "std::map< std::string,std::string > *|std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > *", 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__pairT_std__string_int_t = {"_p_std__pairT_std__string_int_t", "std::pair< std::string,NTA_Int32 > *|std::pair< std::string,int > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__pairT_std__string_std__string_t = {"_p_std__pairT_std__string_std__string_t", "std::pair< std::string,std::string > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__pairT_unsigned_int_double_t = {"_p_std__pairT_unsigned_int_double_t", "std::pair< nupic::UInt32,nupic::Real64 > *|std::pair< unsigned int,double > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__pairT_unsigned_int_float_t = {"_p_std__pairT_unsigned_int_float_t", "std::pair< unsigned int,float > *|std::pair< nupic::UInt32,nupic::Real32 > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__pairT_unsigned_int_unsigned_int_t = {"_p_std__pairT_unsigned_int_unsigned_int_t", "std::pair< nupic::UInt32,nupic::UInt32 > *|std::pair< unsigned int,unsigned int > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t = {"_p_std__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t", "std::set< std::string,std::less< std::string >,std::allocator< std::string > > *|std::set< std::string > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_double_std__allocatorT_double_t_t = {"_p_std__vectorT_double_std__allocatorT_double_t_t", "std::vector< double,std::allocator< double > > *|std::vector< NTA_Real64 > *|std::vector< double > *", 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::allocator< float > > *|std::vector< float > *|std::vector< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< nupic::Real32 > >::value_type,std::allocator< nupic::SparseMatrix< nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero< nupic::Real32 > >::value_type > > *|std::vector< NTA_Real32 > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_int_std__allocatorT_int_t_t = {"_p_std__vectorT_int_std__allocatorT_int_t_t", "std::vector< int,std::allocator< int > > *|std::vector< NTA_Int32 > *|std::vector< int > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_long_std__allocatorT_long_t_t = {"_p_std__vectorT_long_std__allocatorT_long_t_t", "std::vector< long,std::allocator< long > > *|std::vector< long > *|std::vector< NTA_Int64 > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t = {"_p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t", "std::vector< std::map< std::string,std::string > > *|std::vector< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > >,std::allocator< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > > *|std::vector< std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > > *", 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::UInt32,nupic::Real32 > > *|std::vector< std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > > *|std::vector< std::pair< unsigned int,float >,std::allocator< std::pair< unsigned int,float > > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t = {"_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t", "std::vector< std::pair< unsigned int,double > > *|std::vector< std::pair< nupic::UInt32,nupic::Real64 > > *|std::vector< std::pair< nupic::UInt32,nupic::Real64 >,std::allocator< std::pair< nupic::UInt32,nupic::Real64 > > > *|std::vector< std::pair< unsigned int,double >,std::allocator< std::pair< unsigned int,double > > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t = {"_p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t", "std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > *|std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > *|std::vector< std::pair< unsigned int,unsigned int > > *|std::vector< std::pair< unsigned int,unsigned int >,std::allocator< std::pair< unsigned int,unsigned int > > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t = {"_p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t", "std::vector< std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > > *|std::vector< std::pair< std::string,std::string > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_std__string_std__allocatorT_std__string_t_t = {"_p_std__vectorT_std__string_std__allocatorT_std__string_t_t", "std::vector< std::string,std::allocator< std::string > > *|std::vector< std::string > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t = {"_p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t", "std::vector< std::vector< std::pair< unsigned int,unsigned int > > > *|std::vector< std::vector< std::pair< unsigned int,unsigned int >,std::allocator< std::pair< unsigned int,unsigned int > > >,std::allocator< std::vector< std::pair< unsigned int,unsigned int >,std::allocator< std::pair< unsigned int,unsigned int > > > > > *|std::vector< std::vector< std::pair< unsigned int,unsigned int >,std::allocator< std::pair< unsigned int,unsigned int > > > > *|std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 > > > *|std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > >,std::allocator< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > > *|std::vector< std::vector< std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > *", 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", "TIV *|std::vector< unsigned int,std::allocator< unsigned int > > *|std::vector< NTA_UInt32 > *|std::vector< unsigned int > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t = {"_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t", "std::vector< unsigned long > *|std::vector< unsigned long,std::allocator< unsigned long > > *|std::vector< NTA_UInt64 > *", 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_int = {"_p_unsigned_int", "NTA_UInt *|NTA_UInt32 *|nupic::UInt32 *|unsigned int *|nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::const_row_nz_index_iterator|nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > >::size_type *|nupic::UInt *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_long = {"_p_unsigned_long", "NTA_UInt64 *|nupic::UInt64 *|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_IJV,
  &_swigt__p_NTA_BasicType,
  &_swigt__p_NTA_LogLevel,
  &_swigt__p_PyDomain,
  &_swigt__p_PySparseTensor,
  &_swigt__p_PyTensorIndex,
  &_swigt__p_RandomProto__Builder,
  &_swigt__p_RandomProto__Reader,
  &_swigt__p_Row,
  &_swigt__p_SparseBinaryMatrixProto__Builder,
  &_swigt__p_SparseBinaryMatrixProto__Reader,
  &_swigt__p_SparseMatrixProto__Builder,
  &_swigt__p_SparseMatrixProto__Reader,
  &_swigt__p_allocator_type,
  &_swigt__p_argument_type,
  &_swigt__p_char,
  &_swigt__p_difference_type,
  &_swigt__p_double,
  &_swigt__p_f___unsigned_long,
  &_swigt__p_first_type,
  &_swigt__p_float,
  &_swigt__p_int,
  &_swigt__p_key_type,
  &_swigt__p_long,
  &_swigt__p_mapped_type,
  &_swigt__p_nupic__DistanceToZeroT_float_t,
  &_swigt__p_nupic__Domain2DT_unsigned_int_t,
  &_swigt__p_nupic__DomainT_unsigned_int_t,
  &_swigt__p_nupic__Gaussian2DT_float_t,
  &_swigt__p_nupic__IsNearlyZeroT_nupic__DistanceToZeroT_nupic__Real32_t_t,
  &_swigt__p_nupic__LogDiffApprox,
  &_swigt__p_nupic__LogSumApprox,
  &_swigt__p_nupic__LoggingException,
  &_swigt__p_nupic__NearestNeighborT_nupic__SparseMatrixT_nupic__UInt32_nupic__Real32_nupic__Int32_nupic__Real64_nupic__DistanceToZeroT_nupic__Real32_t_t_t,
  &_swigt__p_nupic__Random,
  &_swigt__p_nupic__SetT_unsigned_int_unsigned_char_t,
  &_swigt__p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t,
  &_swigt__p_nupic__SparseMatrixAlgorithms,
  &_swigt__p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,
  &_swigt__p_nz_index_type,
  &_swigt__p_p_PyObject,
  &_swigt__p_p_void,
  &_swigt__p_parent_type,
  &_swigt__p_prec_value_type,
  &_swigt__p_result_type,
  &_swigt__p_second_type,
  &_swigt__p_self_type,
  &_swigt__p_short,
  &_swigt__p_size_t,
  &_swigt__p_size_type,
  &_swigt__p_std__allocatorT_double_t,
  &_swigt__p_std__allocatorT_float_t,
  &_swigt__p_std__allocatorT_int_t,
  &_swigt__p_std__allocatorT_long_t,
  &_swigt__p_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t,
  &_swigt__p_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t,
  &_swigt__p_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t,
  &_swigt__p_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t,
  &_swigt__p_std__allocatorT_std__pairT_std__string_const_std__string_t_t,
  &_swigt__p_std__allocatorT_std__pairT_std__string_std__string_t_t,
  &_swigt__p_std__allocatorT_std__string_t,
  &_swigt__p_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t,
  &_swigt__p_std__allocatorT_unsigned_int_t,
  &_swigt__p_std__allocatorT_unsigned_long_t,
  &_swigt__p_std__invalid_argument,
  &_swigt__p_std__istream,
  &_swigt__p_std__lessT_std__string_t,
  &_swigt__p_std__listT_std__string_std__allocatorT_std__string_t_t,
  &_swigt__p_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t,
  &_swigt__p_std__ostream,
  &_swigt__p_std__pairT_std__string_int_t,
  &_swigt__p_std__pairT_std__string_std__string_t,
  &_swigt__p_std__pairT_unsigned_int_double_t,
  &_swigt__p_std__pairT_unsigned_int_float_t,
  &_swigt__p_std__pairT_unsigned_int_unsigned_int_t,
  &_swigt__p_std__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t,
  &_swigt__p_std__vectorT_double_std__allocatorT_double_t_t,
  &_swigt__p_std__vectorT_float_std__allocatorT_float_t_t,
  &_swigt__p_std__vectorT_int_std__allocatorT_int_t_t,
  &_swigt__p_std__vectorT_long_std__allocatorT_long_t_t,
  &_swigt__p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_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__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t,
  &_swigt__p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t,
  &_swigt__p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t,
  &_swigt__p_std__vectorT_std__string_std__allocatorT_std__string_t_t,
  &_swigt__p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t,
  &_swigt__p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,
  &_swigt__p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t,
  &_swigt__p_swig__SwigPyIterator,
  &_swigt__p_uintptr_t,
  &_swigt__p_unsigned_int,
  &_swigt__p_unsigned_long,
  &_swigt__p_unsigned_short,
  &_swigt__p_value_type,
};

static swig_cast_info _swigc__p_IJV[] = {  {&_swigt__p_IJV, 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_PyDomain[] = {  {&_swigt__p_PyDomain, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_PySparseTensor[] = {  {&_swigt__p_PySparseTensor, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_PyTensorIndex[] = {  {&_swigt__p_PyTensorIndex, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_RandomProto__Builder[] = {  {&_swigt__p_RandomProto__Builder, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_RandomProto__Reader[] = {  {&_swigt__p_RandomProto__Reader, 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_SparseBinaryMatrixProto__Builder[] = {  {&_swigt__p_SparseBinaryMatrixProto__Builder, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_SparseBinaryMatrixProto__Reader[] = {  {&_swigt__p_SparseBinaryMatrixProto__Reader, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_SparseMatrixProto__Builder[] = {  {&_swigt__p_SparseMatrixProto__Builder, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_SparseMatrixProto__Reader[] = {  {&_swigt__p_SparseMatrixProto__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_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_f___unsigned_long[] = {  {&_swigt__p_f___unsigned_long, 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_key_type[] = {  {&_swigt__p_key_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__DistanceToZeroT_float_t[] = {  {&_swigt__p_nupic__DistanceToZeroT_float_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__Domain2DT_unsigned_int_t[] = {  {&_swigt__p_nupic__Domain2DT_unsigned_int_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__DomainT_unsigned_int_t[] = {  {&_swigt__p_nupic__DomainT_unsigned_int_t, 0, 0, 0},  {&_swigt__p_nupic__Domain2DT_unsigned_int_t, _p_nupic__Domain2DT_unsigned_int_tTo_p_nupic__DomainT_unsigned_int_t, 0, 0},  {&_swigt__p_PyDomain, _p_PyDomainTo_p_nupic__DomainT_unsigned_int_t, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__Gaussian2DT_float_t[] = {  {&_swigt__p_nupic__Gaussian2DT_float_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__IsNearlyZeroT_nupic__DistanceToZeroT_nupic__Real32_t_t[] = {  {&_swigt__p_nupic__IsNearlyZeroT_nupic__DistanceToZeroT_nupic__Real32_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__LogDiffApprox[] = {  {&_swigt__p_nupic__LogDiffApprox, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__LogSumApprox[] = {  {&_swigt__p_nupic__LogSumApprox, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__LoggingException[] = {  {&_swigt__p_nupic__LoggingException, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__NearestNeighborT_nupic__SparseMatrixT_nupic__UInt32_nupic__Real32_nupic__Int32_nupic__Real64_nupic__DistanceToZeroT_nupic__Real32_t_t_t[] = {  {&_swigt__p_nupic__NearestNeighborT_nupic__SparseMatrixT_nupic__UInt32_nupic__Real32_nupic__Int32_nupic__Real64_nupic__DistanceToZeroT_nupic__Real32_t_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__Random[] = {  {&_swigt__p_nupic__Random, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__SetT_unsigned_int_unsigned_char_t[] = {  {&_swigt__p_nupic__SetT_unsigned_int_unsigned_char_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t[] = {  {&_swigt__p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__SparseMatrixAlgorithms[] = {  {&_swigt__p_nupic__SparseMatrixAlgorithms, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t[] = {  {&_swigt__p_nupic__NearestNeighborT_nupic__SparseMatrixT_nupic__UInt32_nupic__Real32_nupic__Int32_nupic__Real64_nupic__DistanceToZeroT_nupic__Real32_t_t_t, _p_nupic__NearestNeighborT_nupic__SparseMatrixT_nupic__UInt32_nupic__Real32_nupic__Int32_nupic__Real64_nupic__DistanceToZeroT_nupic__Real32_t_t_tTo_p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 0, 0},  {&_swigt__p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t, 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_p_PyObject[] = {  {&_swigt__p_p_PyObject, 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_result_type[] = {  {&_swigt__p_result_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_double_t[] = {  {&_swigt__p_std__allocatorT_double_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__allocatorT_float_t[] = {  {&_swigt__p_std__allocatorT_float_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__allocatorT_int_t[] = {  {&_swigt__p_std__allocatorT_int_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__allocatorT_long_t[] = {  {&_swigt__p_std__allocatorT_long_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t[] = {  {&_swigt__p_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t[] = {  {&_swigt__p_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t[] = {  {&_swigt__p_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t[] = {  {&_swigt__p_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__allocatorT_std__pairT_std__string_const_std__string_t_t[] = {  {&_swigt__p_std__allocatorT_std__pairT_std__string_const_std__string_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__allocatorT_std__pairT_std__string_std__string_t_t[] = {  {&_swigt__p_std__allocatorT_std__pairT_std__string_std__string_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__allocatorT_std__string_t[] = {  {&_swigt__p_std__allocatorT_std__string_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t[] = {  {&_swigt__p_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__allocatorT_unsigned_int_t[] = {  {&_swigt__p_std__allocatorT_unsigned_int_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__allocatorT_unsigned_long_t[] = {  {&_swigt__p_std__allocatorT_unsigned_long_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__invalid_argument[] = {  {&_swigt__p_std__invalid_argument, 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__lessT_std__string_t[] = {  {&_swigt__p_std__lessT_std__string_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__listT_std__string_std__allocatorT_std__string_t_t[] = {  {&_swigt__p_std__listT_std__string_std__allocatorT_std__string_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t[] = {  {&_swigt__p_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_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__pairT_std__string_int_t[] = {  {&_swigt__p_std__pairT_std__string_int_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__pairT_std__string_std__string_t[] = {  {&_swigt__p_std__pairT_std__string_std__string_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__pairT_unsigned_int_double_t[] = {  {&_swigt__p_std__pairT_unsigned_int_double_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__pairT_unsigned_int_float_t[] = {  {&_swigt__p_std__pairT_unsigned_int_float_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__pairT_unsigned_int_unsigned_int_t[] = {  {&_swigt__p_std__pairT_unsigned_int_unsigned_int_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t[] = {  {&_swigt__p_std__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_double_std__allocatorT_double_t_t[] = {  {&_swigt__p_std__vectorT_double_std__allocatorT_double_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_std__allocatorT_int_t_t[] = {  {&_swigt__p_std__vectorT_int_std__allocatorT_int_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_long_std__allocatorT_long_t_t[] = {  {&_swigt__p_std__vectorT_long_std__allocatorT_long_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t_t[] = {  {&_swigt__p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_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__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t[] = {  {&_swigt__p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t[] = {  {&_swigt__p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t[] = {  {&_swigt__p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_std__string_std__allocatorT_std__string_t_t[] = {  {&_swigt__p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t[] = {  {&_swigt__p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_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_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t[] = {  {&_swigt__p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_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_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_IJV,
  _swigc__p_NTA_BasicType,
  _swigc__p_NTA_LogLevel,
  _swigc__p_PyDomain,
  _swigc__p_PySparseTensor,
  _swigc__p_PyTensorIndex,
  _swigc__p_RandomProto__Builder,
  _swigc__p_RandomProto__Reader,
  _swigc__p_Row,
  _swigc__p_SparseBinaryMatrixProto__Builder,
  _swigc__p_SparseBinaryMatrixProto__Reader,
  _swigc__p_SparseMatrixProto__Builder,
  _swigc__p_SparseMatrixProto__Reader,
  _swigc__p_allocator_type,
  _swigc__p_argument_type,
  _swigc__p_char,
  _swigc__p_difference_type,
  _swigc__p_double,
  _swigc__p_f___unsigned_long,
  _swigc__p_first_type,
  _swigc__p_float,
  _swigc__p_int,
  _swigc__p_key_type,
  _swigc__p_long,
  _swigc__p_mapped_type,
  _swigc__p_nupic__DistanceToZeroT_float_t,
  _swigc__p_nupic__Domain2DT_unsigned_int_t,
  _swigc__p_nupic__DomainT_unsigned_int_t,
  _swigc__p_nupic__Gaussian2DT_float_t,
  _swigc__p_nupic__IsNearlyZeroT_nupic__DistanceToZeroT_nupic__Real32_t_t,
  _swigc__p_nupic__LogDiffApprox,
  _swigc__p_nupic__LogSumApprox,
  _swigc__p_nupic__LoggingException,
  _swigc__p_nupic__NearestNeighborT_nupic__SparseMatrixT_nupic__UInt32_nupic__Real32_nupic__Int32_nupic__Real64_nupic__DistanceToZeroT_nupic__Real32_t_t_t,
  _swigc__p_nupic__Random,
  _swigc__p_nupic__SetT_unsigned_int_unsigned_char_t,
  _swigc__p_nupic__SparseBinaryMatrixT_unsigned_int_unsigned_int_t,
  _swigc__p_nupic__SparseMatrixAlgorithms,
  _swigc__p_nupic__SparseMatrixT_unsigned_int_float_int_double_nupic__DistanceToZeroT_nupic__Real32_t_t,
  _swigc__p_nz_index_type,
  _swigc__p_p_PyObject,
  _swigc__p_p_void,
  _swigc__p_parent_type,
  _swigc__p_prec_value_type,
  _swigc__p_result_type,
  _swigc__p_second_type,
  _swigc__p_self_type,
  _swigc__p_short,
  _swigc__p_size_t,
  _swigc__p_size_type,
  _swigc__p_std__allocatorT_double_t,
  _swigc__p_std__allocatorT_float_t,
  _swigc__p_std__allocatorT_int_t,
  _swigc__p_std__allocatorT_long_t,
  _swigc__p_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_t,
  _swigc__p_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t,
  _swigc__p_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t,
  _swigc__p_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t,
  _swigc__p_std__allocatorT_std__pairT_std__string_const_std__string_t_t,
  _swigc__p_std__allocatorT_std__pairT_std__string_std__string_t_t,
  _swigc__p_std__allocatorT_std__string_t,
  _swigc__p_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t,
  _swigc__p_std__allocatorT_unsigned_int_t,
  _swigc__p_std__allocatorT_unsigned_long_t,
  _swigc__p_std__invalid_argument,
  _swigc__p_std__istream,
  _swigc__p_std__lessT_std__string_t,
  _swigc__p_std__listT_std__string_std__allocatorT_std__string_t_t,
  _swigc__p_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t,
  _swigc__p_std__ostream,
  _swigc__p_std__pairT_std__string_int_t,
  _swigc__p_std__pairT_std__string_std__string_t,
  _swigc__p_std__pairT_unsigned_int_double_t,
  _swigc__p_std__pairT_unsigned_int_float_t,
  _swigc__p_std__pairT_unsigned_int_unsigned_int_t,
  _swigc__p_std__setT_std__string_std__lessT_std__string_t_std__allocatorT_std__string_t_t,
  _swigc__p_std__vectorT_double_std__allocatorT_double_t_t,
  _swigc__p_std__vectorT_float_std__allocatorT_float_t_t,
  _swigc__p_std__vectorT_int_std__allocatorT_int_t_t,
  _swigc__p_std__vectorT_long_std__allocatorT_long_t_t,
  _swigc__p_std__vectorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_t_std__allocatorT_std__mapT_std__string_std__string_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__string_t_t_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__pairT_nupic__UInt32_nupic__Real64_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real64_t_t_t,
  _swigc__p_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t,
  _swigc__p_std__vectorT_std__pairT_std__string_std__string_t_std__allocatorT_std__pairT_std__string_std__string_t_t_t,
  _swigc__p_std__vectorT_std__string_std__allocatorT_std__string_t_t,
  _swigc__p_std__vectorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_std__allocatorT_std__vectorT_std__pairT_nupic__UInt32_nupic__UInt32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__UInt32_t_t_t_t_t,
  _swigc__p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,
  _swigc__p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t,
  _swigc__p_swig__SwigPyIterator,
  _swigc__p_uintptr_t,
  _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);
  
  
  
  // Perform necessary library initialization (in C++).
  import_array();
  
  
  SWIG_Python_SetConstant(d, "NTA_BasicType_Byte",SWIG_From_int(static_cast< int >(NTA_BasicType_Byte)));
  SWIG_Python_SetConstant(d, "NTA_BasicType_Int16",SWIG_From_int(static_cast< int >(NTA_BasicType_Int16)));
  SWIG_Python_SetConstant(d, "NTA_BasicType_UInt16",SWIG_From_int(static_cast< int >(NTA_BasicType_UInt16)));
  SWIG_Python_SetConstant(d, "NTA_BasicType_Int32",SWIG_From_int(static_cast< int >(NTA_BasicType_Int32)));
  SWIG_Python_SetConstant(d, "NTA_BasicType_UInt32",SWIG_From_int(static_cast< int >(NTA_BasicType_UInt32)));
  SWIG_Python_SetConstant(d, "NTA_BasicType_Int64",SWIG_From_int(static_cast< int >(NTA_BasicType_Int64)));
  SWIG_Python_SetConstant(d, "NTA_BasicType_UInt64",SWIG_From_int(static_cast< int >(NTA_BasicType_UInt64)));
  SWIG_Python_SetConstant(d, "NTA_BasicType_Real32",SWIG_From_int(static_cast< int >(NTA_BasicType_Real32)));
  SWIG_Python_SetConstant(d, "NTA_BasicType_Real64",SWIG_From_int(static_cast< int >(NTA_BasicType_Real64)));
  SWIG_Python_SetConstant(d, "NTA_BasicType_Handle",SWIG_From_int(static_cast< int >(NTA_BasicType_Handle)));
  SWIG_Python_SetConstant(d, "NTA_BasicType_Last",SWIG_From_int(static_cast< int >(NTA_BasicType_Last)));
  SWIG_Python_SetConstant(d, "NTA_BasicType_Real",SWIG_From_int(static_cast< int >(NTA_BasicType_Real)));
  SWIG_Python_SetConstant(d, "NTA_REAL_TYPE_STRING",SWIG_FromCharPtr("NTA_Real32"));
  SWIG_Python_SetConstant(d, "NTA_LogLevel_None",SWIG_From_int(static_cast< int >(NTA_LogLevel_None)));
  SWIG_Python_SetConstant(d, "NTA_LogLevel_Minimal",SWIG_From_int(static_cast< int >(NTA_LogLevel_Minimal)));
  SWIG_Python_SetConstant(d, "NTA_LogLevel_Normal",SWIG_From_int(static_cast< int >(NTA_LogLevel_Normal)));
  SWIG_Python_SetConstant(d, "NTA_LogLevel_Verbose",SWIG_From_int(static_cast< int >(NTA_LogLevel_Verbose)));
  SWIG_Python_SetConstant(d, "LogLevel_None",SWIG_From_int(static_cast< int >(nupic::LogLevel_None)));
  SWIG_Python_SetConstant(d, "LogLevel_Minimal",SWIG_From_int(static_cast< int >(nupic::LogLevel_Minimal)));
  SWIG_Python_SetConstant(d, "LogLevel_Normal",SWIG_From_int(static_cast< int >(nupic::LogLevel_Normal)));
  SWIG_Python_SetConstant(d, "LogLevel_Verbose",SWIG_From_int(static_cast< int >(nupic::LogLevel_Verbose)));
  PyDict_SetItemString(md,(char*)"cvar", SWIG_globals());
  SWIG_addvarlink(SWIG_globals(),(char*)"Epsilon",Swig_var_Epsilon_get, Swig_var_Epsilon_set);
  SWIG_Python_SetConstant(d, "PYSPARSETENSOR_MAX_RANK",SWIG_From_int(static_cast< int >(20)));
  SWIG_addvarlink(SWIG_globals(),(char*)"pi",Swig_var_pi_get, Swig_var_pi_set);
  SWIG_addvarlink(SWIG_globals(),(char*)"Random_MAX32",Swig_var_Random_MAX32_get, Swig_var_Random_MAX32_set);
  SWIG_addvarlink(SWIG_globals(),(char*)"Random_MAX64",Swig_var_Random_MAX64_get, Swig_var_Random_MAX64_set);
#if PY_VERSION_HEX >= 0x03000000
  return m;
#else
  return;
#endif
}

