summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdoardo Pasca <edo.paskino@gmail.com>2017-08-04 16:16:53 +0100
committerEdoardo Pasca <edo.paskino@gmail.com>2017-08-04 16:16:53 +0100
commitfbaf7281141e0ddad5046b433ba0a72d360d09aa (patch)
tree2a46e7b01dc84b8c115c634704d458aa34fdcf5d
parent3e96c0d80387225894a8e5f1456ea310cd7e797b (diff)
downloadregularization-fbaf7281141e0ddad5046b433ba0a72d360d09aa.tar.gz
regularization-fbaf7281141e0ddad5046b433ba0a72d360d09aa.tar.bz2
regularization-fbaf7281141e0ddad5046b433ba0a72d360d09aa.tar.xz
regularization-fbaf7281141e0ddad5046b433ba0a72d360d09aa.zip
minor change
-rw-r--r--src/Python/Matlab2Python_utils.cpp10
1 files changed, 7 insertions, 3 deletions
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();