diff options
author | Edoardo Pasca <edo.paskino@gmail.com> | 2017-08-04 16:16:53 +0100 |
---|---|---|
committer | Edoardo Pasca <edo.paskino@gmail.com> | 2017-10-11 15:38:09 +0100 |
commit | 4bef3726577ddf1bf2b594620e106573c6f18693 (patch) | |
tree | 6496288261998ae3b61fd0b3cf3274274aeb51fc | |
parent | fd496731c8e9d4975864d76dbb6574cbeee7cf98 (diff) | |
download | regularization-4bef3726577ddf1bf2b594620e106573c6f18693.tar.gz regularization-4bef3726577ddf1bf2b594620e106573c6f18693.tar.bz2 regularization-4bef3726577ddf1bf2b594620e106573c6f18693.tar.xz regularization-4bef3726577ddf1bf2b594620e106573c6f18693.zip |
minor change
-rw-r--r-- | src/Python/Matlab2Python_utils.cpp | 10 |
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(); |