From 4bef3726577ddf1bf2b594620e106573c6f18693 Mon Sep 17 00:00:00 2001
From: Edoardo Pasca <edo.paskino@gmail.com>
Date: Fri, 4 Aug 2017 16:16:53 +0100
Subject: minor change

---
 src/Python/Matlab2Python_utils.cpp | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

(limited to 'src')

diff --git a/src/Python/Matlab2Python_utils.cpp b/src/Python/Matlab2Python_utils.cpp
index 138e8da..6aaad90 100644
--- a/src/Python/Matlab2Python_utils.cpp
+++ b/src/Python/Matlab2Python_utils.cpp
@@ -128,7 +128,11 @@ T * mxGetData(const np::ndarray pm) {
 
 template<typename T>
 np::ndarray zeros(int dims , int * dim_array, T el) {
-	bp::tuple shape = bp::make_tuple(dim_array[0], dim_array[1], dim_array[2]);
+	bp::tuple shape;
+	if (dims == 3)
+		shape = bp::make_tuple(dim_array[0], dim_array[1], dim_array[2]);
+	else if (dims == 2)
+		shape = bp::make_tuple(dim_array[0], dim_array[1]);
 	np::dtype dtype = np::dtype::get_builtin<T>();
 	np::ndarray zz = np::zeros(shape, dtype);
 	return zz;
@@ -163,7 +167,7 @@ bp::list mexFunction( np::ndarray input ) {
 			for (int k = 0; k < dim_array[2]; k++) {
 				int index = k + dim_array[2] * j + dim_array[2] * dim_array[1] * i;
 				int val = (*(A + index));
-				float fval = (float)val;
+				float fval = sqrt((float)val);
 				std::memcpy(B + index , &val, sizeof(int));
 				std::memcpy(C + index , &fval, sizeof(float));
 			}
@@ -186,7 +190,7 @@ bp::list mexFunction( np::ndarray input ) {
 }
 
 
-BOOST_PYTHON_MODULE(fista)
+BOOST_PYTHON_MODULE(prova)
 {
 	np::initialize();
 
-- 
cgit v1.2.3