diff --git a/src/nupic/bindings/engine_internal.i b/src/nupic/bindings/engine_internal.i index cff72d3256..c361f680fb 100644 --- a/src/nupic/bindings/engine_internal.i +++ b/src/nupic/bindings/engine_internal.i @@ -149,7 +149,9 @@ class IterablePair(object): //32bit fix - Already seen by swig on linux32 where size_t is the same size as unsigned int -#if !(defined(NTA_ARCH_32) && defined(NTA_OS_LINUX)) +#if (defined(NTA_ARCH_32) && defined(NTA_OS_LINUX)) +%template(Dimset) std::vector; +#else %template(Dimset) std::vector; #endif diff --git a/src/nupic/ntypes/Dimensions.cpp b/src/nupic/ntypes/Dimensions.cpp index 3332298b63..75af4099ae 100644 --- a/src/nupic/ntypes/Dimensions.cpp +++ b/src/nupic/ntypes/Dimensions.cpp @@ -25,6 +25,10 @@ #include #include +#if (defined(NTA_ARCH_32) && defined(NTA_OS_LINUX)) +#include +#endif + using namespace nupic; Dimensions::Dimensions(){}; @@ -32,6 +36,14 @@ Dimensions::Dimensions(){}; Dimensions::Dimensions(std::vector v) : std::vector(std::move(v)){}; +#if (defined(NTA_ARCH_32) && defined(NTA_OS_LINUX)) +Dimensions::Dimensions(std::vector v) { + for (size_t i = 0; i < v.size(); i++) { + push_back(v[i] & UINT_MAX); + } +} +#endif + Dimensions::Dimensions(size_t x) { push_back(x); } Dimensions::Dimensions(size_t x, size_t y) { diff --git a/src/nupic/ntypes/Dimensions.hpp b/src/nupic/ntypes/Dimensions.hpp index 944c8d141c..d6ef48958f 100644 --- a/src/nupic/ntypes/Dimensions.hpp +++ b/src/nupic/ntypes/Dimensions.hpp @@ -98,8 +98,20 @@ class Dimensions : public std::vector { */ Dimensions(std::vector v); - /** Create a new 1-dimension Dimensions object. +#if (defined(NTA_ARCH_32) && defined(NTA_OS_LINUX)) + /** + * Create a new Dimensions object from a @c std::vector. + * + * @param v + * A @c std::vector of @c unsigned long, the value with the index + * of @a n is the size of the @a n th dimension + * + */ + Dimensions(std::vector v); +#endif + /** Create a new 1-dimension Dimensions object. + * * @param x * The size of the 1st dimension *