Questions tagged [boost-multi-array]

Boost.MultiArray is a C++ library that provides a class template for multidimensional arrays, as well as semantically equivalent adaptors for arrays of contiguous data.

Boost.MultiArray is a C++ library that provides a class template for multidimensional arrays, as well as semantically equivalent adaptors for arrays of contiguous data. The classes in this library implement a common interface, formalized as a generic programming concept. The interface design is in line with the precedent set by the C++ Standard Library containers. Boost MultiArray is a more efficient and convenient way to express N-dimensional arrays than existing alternatives (especially the std::vector<std::vector<...> > formulation of N-dimensional arrays). The arrays provided by the library may be accessed using the familiar syntax of native C++ arrays. Additional features, such as resizing, reshaping, and creating views are available.

108 questions
36
votes
4 answers

Compare blitz++, armadillo, boost::MultiArray

I did a comparison between blitz++, armadillo, boost::MultiArray with the following code (borrowed from an old post) #include using namespace std; #include #define _SCL_SECURE_NO_WARNINGS #define BOOST_DISABLE_ASSERTS…
user1899020
  • 13,167
  • 21
  • 79
  • 154
27
votes
17 answers

Boost::multi_array performance question

I am trying to compare the performance of boost::multi_array to native dynamically allocated arrays, with the following test program: #include #define _SCL_SECURE_NO_WARNINGS #define BOOST_DISABLE_ASSERTS #include…
Steve Fallows
  • 6,274
  • 5
  • 47
  • 67
16
votes
3 answers

boost::multi_array resize doesn't work

I can't get boost::multi_array resizing to work. When I try it, it gives errors about std::_Copy_impl and the like. Here is the code #include typedef boost::multi_array array_type; class arrayclass{ public: …
Yelnats
  • 335
  • 1
  • 3
  • 7
14
votes
2 answers

Boost Multiarray Dimensions

I have a Boost multiarray whose dimensions are set at run-time based on input from the user. I'd now like to iterate over that array via x,y,z components. If this were a std::vector, I would use: for(int i=0;i
Richard
  • 56,349
  • 34
  • 180
  • 251
12
votes
1 answer

What is the difference betwen boost::multi_array views and subarrays

After looking the documentation I cannot figure this one out. I can write code such as typedef boost::multi_array data_t; // 3d -- typedef data_t::array_view<3>::type data_3d_view_t; // 2d -- typedef data_3d_view_t::reference…
rodrigob
  • 2,891
  • 3
  • 30
  • 34
10
votes
2 answers

How to specify degenerate dimension of boost multi_array at runtime?

I have a 3D multi_array and I would like to make 2D slices using dimensions specified at runtime. I know the index of degenerate dimension and the index of a slice that I want to extract in that degenerate dimension. Currently the ugly workaround…
Anton Daneyko
  • 6,528
  • 5
  • 31
  • 59
9
votes
1 answer

how to traverse a boost::multi_array

I have been looking into the boost::multi_array library in search of an iterator that allows you to traverse the whole multi_array in a single for loop. I don't think there is any such iterator in that library. (The iterators that are found there…
9
votes
1 answer

How to assign / copy a Boost::multi_array

I want to assign a copy of a boost::multi_array. How can I do this. The object where I want to assign it to has been initialized with the default constructors. This code does not work, because the dimensions and size are not the same class Field { …
Peter Smit
  • 27,696
  • 33
  • 111
  • 170
8
votes
1 answer

Why does boost::multi_array's ConstMultiArrayConcept have a NumDims template argument?

I wrote an operator<< specialization that handles boost::multi_array, and used ConstMultiArrayConcept so that it would work on both the outer array and the sub-arrays. I'm wondering, though, why the multi_array concepts have a std::size_t NumDims…
7
votes
3 answers

One-line initialiser for Boost.MultiArray

I have a n-dimensional Boost.MultiArray I initialize as follows: const int n=3, size=4; //# of dimensions and size of one dimension boost::multi_array arr; boost::array extents; //size of each dimension extents.assign(size);…
tstenner
  • 10,080
  • 10
  • 57
  • 92
7
votes
3 answers

How to get max/min element from a boost multiarray

I'm wondering a simple way to find the maximum/minimum element of a boost multiarray, an object of 3 indices as the following: int iDepth=10,iWidth=10,iHeight=10; boost::multi_array image(boost::extents[iDepth][iWidth][iHeight]);
linello
  • 8,451
  • 18
  • 63
  • 109
7
votes
1 answer

pointers to a class in dynamically allocated boost multi_array, not compiling

I am pretty new to C++ with Boost. I want an object of class "world" to have an array named "chunk" of type "octreenode". Previously I had an ordinary one-dimensional array, and this worked fine. Now I'm trying to move to using a 3D array with…
Riot
  • 15,723
  • 4
  • 60
  • 67
5
votes
1 answer

Boost multi_array range compilation

A range can be used to slice a Boost Multidimensional array (multi_array). According to the documentation there are several ways of defining a range, however not all of them will compile. I'm using GCC 4.5.2 on Ubuntu 11.04. #include…
YXD
  • 31,741
  • 15
  • 75
  • 115
5
votes
3 answers

What is the type of a boost::extent object after providing dimensions?

Say I have #include using intArray3D = boost::multi_array; and I want to create a bunch of intArray3Ds with the same shape: auto my_shape = boost::extents[3][4][5]; intArray3D xs(my_shape), ys(my_shape),…
rayhem
  • 741
  • 1
  • 8
  • 23
5
votes
1 answer

How to std::move a boost::multi_array?

It doesn't appear that multi_array has a move constructor - is this correct? Is there a reason for this or was it just never implemented since the class seems to have been written before move semantics were available? Is there anything to be done…
David Doria
  • 9,873
  • 17
  • 85
  • 147
1
2 3 4 5 6 7 8