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
1
vote
0 answers

Why is `index_gen` in `multi_array` a `boost::detail::multi_array::index_gen<0,0>`

This discussion has let to another question. It seems that index_gen in multi_array (a.k.a. boost::multi_array::index_gen) is set to boost::detail::multi_array::index_gen<0,0>, where I would have expected it to be…
David Doria
  • 9,873
  • 17
  • 85
  • 147
1
vote
0 answers

How do you assign a boost::indices in a variable?

I am trying to store a boost::indices in a variable. From what I can gather, this produces an index_gen type. However, index_gen seems to be templated in boost::detail, but the template parameters are not exposed to multi_array::index_gen, and they…
David Doria
  • 9,873
  • 17
  • 85
  • 147
1
vote
1 answer

assignment between array elements using boost multi_array iterator

Working on a Kubuntu 14.04 system with gcc 4.8.4 I ran into the following problem: Using std:vector, I can assign between vector elements via an iterator: std::vector v ; v.push_back(0.0) ; v.push_back(1.0) ; auto vv = v.begin() ; vv[0] =…
1
vote
1 answer

for_each algorithm to loop over boost::multi_array

Related questions have been asked here before, but I still haven't found a satisfactory answer, so I will try to explain my problem and hope someone can enlighten me. I am currently writing some code using boost::multi_array, and the code itself is…
1
vote
1 answer

3D-Grid of bins: nested std::vector vs std::unordered_map

pros, I need some performance-opinions with the following: 1st Question: I want to store objects in a 3D-Grid-Structure, overall it will be ~33% filled, i.e. 2 out of 3 gridpoints will be empty. Short image to illustrate: Maybe Option…
Bersaelor
  • 2,517
  • 34
  • 58
1
vote
1 answer

Complexity of boost::multi_array reshape() function

What is the complexity of boost::multi_array reshape() function? I expect it to be O(1) but I can't find this info in the documentation. The documentation for this library is actually pretty scarce. The reason I'm asking is that I would like to…
Alexey
  • 5,898
  • 9
  • 44
  • 81
1
vote
2 answers

Defining my 2D array to support [] and () access operations

I am writing an image processing application in C++. To define my image type, I am considering using either a boost multi array, or boost ublas matrix or Eigen 2D matrix. I would like to carefully benchmark these for all various operations I intend…
The Vivandiere
  • 3,059
  • 3
  • 28
  • 50
1
vote
1 answer

Boost MultiArrays performance is poor

I noticed that my boost mutiarrays were performing very badly compared to STL Vector. I came upon this question asked earlier, where the most liked answer stated that 1) Boost is nearly as fast as native array 2) You need to change the order in…
The Vivandiere
  • 3,059
  • 3
  • 28
  • 50
1
vote
1 answer

Iterate over all but d-th dimension of any boost::multi_array

Quite often one wants to apply operation f() along dimension d of an N-dimensional array A. This implies looping over all remaining dimensions of A. I tried to figure out if boost::multi_array was capable of this. Function f(A) should work on all…
Stefan
  • 4,380
  • 2
  • 30
  • 33
1
vote
1 answer

Fastest method of accessing elements in Boost MultiArray

What is faster - accessing elements of a multiarray using element selection operator, or traversing over the multiarray using iterators? In my case, I need to do a full pass over all elements of multiarray each time.
Gumbly jr.
  • 729
  • 2
  • 9
  • 18
1
vote
2 answers

Large 3D volume bad_alloc

I'm developing an application that creates a 3D Voronoi Diagram created from a 3D point cloud using boost multi_array allocated dynamically to store the whole diagram. One of the test cases I'm using requires a large amount of memory (around…
1
vote
3 answers

Which is the fastest? A boost::multi_array or a std::vector?

Which is the fastest? A boost::multi_array or a std::vector? I will have (not constant) 17.179.869 elements stored in 3 dimensions which will need to be accessed inside a for loop very rapidly and very often. What would be the most performing? An…
Jeroen
  • 15,257
  • 12
  • 59
  • 102
1
vote
1 answer

Boost Multiarray of std::vector

I'm new to Boost (and also to stackoverflow) and want to use a multiarray of vectors. I have done it that way: typedef boost::multi_array, 2> array_type; array_type* mImage; int mResolution = 1000; mImage = new array_type…
DanS
  • 183
  • 1
  • 2
  • 12
1
vote
1 answer

How to save a boost::multi_array to a file

I'm looking for a simple way to save to and load from a file a 3D boost::multi_array. As far as I know there is no methods in the Boost library which I find odd. I don't need the file to be human readable, so a binary file would be better for…
Félix Cantournet
  • 1,941
  • 13
  • 17
1
vote
0 answers

boost multi_array resize won't compile in VS2008

This minimal code won't compile with VS2008 and boost 1.49 #include "boost/multi_array.hpp" int _tmain(int argc, _TCHAR* argv[]) { boost::multi_array arrayTest; arrayTest.resize(boost::extents[10][11][12]); return 0; } I…
user236520