Search Results

Search found 2 results on 1 pages for 'linai'.

Page 1/1 | 1 

  • Random access view in boost::multi_array

    - by linai
    Here is a boost example: typedef boost::multi_array<double, 1> array_type; typedef array_type::index index; array_type A(boost::extents[100]); for(index i = 0; i != A.size(); ++i) { A[i] = (double)i; } // creating view array_type::index_gen indices; typedef boost::multi_array_types::index_range range; array_type::array_view<1>::type myview = A[ indices[range(0,50)] ]; What this code does is creating a subarray or view mapping onto the original array. This view is continuous and covers from 0th to 50th elements of an original array. What if I need to explicitly define elements I'd like to see in the view? How can I create a view with indices like [1, 5, 35, 23] ? Any ideas?

    Read the article

  • C++ Arrays manipulations (python-like operations)

    - by Linai
    Hi Guys, I'm trying to figure out the best C++ library/package for array manipulations in a manner of python. Basically I need a simplicity like this: values = numpy.array(inp.data) idx1 = numpy.where(values > -2.14) idx2 = numpy.where(values < 2.0) res1 = (values[idx1] - diff1)/1000 res1 = (values[idx2] - diff2)*1000 In python it's just 5 lines, but the simplest way in C++ i can think of is quite a number of nested loops. Pls advise..

    Read the article

1