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
0
votes
2 answers

how to get specific elements from a const boost::multi_array

I would like to know how to read elements from a const boost::multi_array object. Indeed to my knowledge I can't use the operator [] because it's also used to assignement. I have a 3-D dimentional array. So how does one get the element…
saloua
  • 2,433
  • 4
  • 27
  • 37
0
votes
2 answers

2d array from boost::multi_array - unable to compile

I am trying to create a 2d array class based on boost::multi_array. I face two issues in the code given below. (1) The code for the member function col() does not compile saying that ::type’ has not been declared. Where am I going wrong? (2) Is it…
suresh
  • 1,109
  • 1
  • 8
  • 24
0
votes
1 answer

Copying data correctly between Qt Qimage and Boost Multi Array

I want to copy the data from a Qt image into a Boost Multi Array, do some manipulation to the Multi Array and copy the data back to a QImage to display. I am accessing the raw data with Qimage::bits() and trying to copy across with std::copy, and it…
YXD
  • 31,741
  • 15
  • 75
  • 115
0
votes
2 answers

What is the most efficient (time, memory) way to add a 2D-horizontal- and a 2D-vertical-aligned boost::multi_array resulting in a 3D array?

I want to add two boost multi-arrays in C++. The first challenge is the alignment of the two arrays. One of these arrays is vertically aligned and the other is horizontally aligned as shown in the figure below. They shall be added, resulting in a…
UweJ
  • 447
  • 3
  • 10
0
votes
1 answer

instantiating struct with boost multi_array

I have a struct that extends an abstract class and then I add a boost multi_array inside as variable, I get the following error. struct myrunnablestruct : zi::runnable{ boost::multi_array myArray; myrunnablestruct(unsigned int…
h1vpdata
  • 331
  • 2
  • 15
0
votes
1 answer

boost::multi_index_container compile error due to incomplete type on index typedef'ing

I am using the boost::multi_index_container (as follows) and I am running into a compile error when trying to typedef the index: struct del_t { string del_id; string dev_version; }; struct count_container_t { uint32_t count_1; uint32_t…
decimus phostle
  • 1,040
  • 2
  • 13
  • 28
0
votes
0 answers

boost multi array typedef not recognized c++

I m quite new to c++ but working hard. I m using the boost::multi_array library in a project but I got problem with typedef. //in main.h #include "boost/multi_array.hpp" #DEFINE D #include "montecarlo.h" typedef boost::multi_array
Cocco Nat
  • 43
  • 1
  • 4
0
votes
2 answers

Iterate through a boost::multi_array view

I want to understand how to use the view functionality provided by boost::multi_array. Specifically, I want to be able to iterate within a single loop over all elements of a view that represents a particular submatrix of the initial matrix (not…
burnedWood
  • 93
  • 1
  • 9
0
votes
1 answer

Extracting a sub-array from a multi_array

I am trying to extract a sub-array from a multi_array. For this demo, let's assume that there are no collapsed dimensions (i.e. the dimensionality of the sub-array is the same as the original array). I think I am constructing a view with the…
David Doria
  • 9,873
  • 17
  • 85
  • 147
0
votes
1 answer

boost_multi array too large? bad_alloc error

I am writing a program to test a feature. However, I get an error when I declare a boost::multi_array that has a certain size. I get the following error: terminate called after throwing an instance of 'std::bad_alloc' what(): …
0
votes
1 answer

Boost multiarray 3D

I am using a boost mutli array for 2D as follows, typedef boost::multi_array array_type; typedef array_type::index index; // initialize array array_type U(boost::extents[N][3]); for(index i = 0; i != N; ++i) { …
heri-salmas
  • 103
  • 2
  • 12
0
votes
1 answer

Including boost::multi_array in a class with not specified number of dimensions

I am creating a gridcell class which is basically a multi array of cells. I want this gridcell to have any number of dimensions. This means that in the declaration of the boost::multiarray variable I cannot specify the second argument of the…
Javi
  • 3,440
  • 5
  • 29
  • 43
0
votes
3 answers

cpp multidimensional vector

I want to store theses string vectors as a 4 dimensional vector. It has been three days that I am searching and I can not decide wether use multidimensional vector,boost multi array ,array of struct ,... I am so new to cpp and they are so…
user1876128
  • 91
  • 14
0
votes
1 answer

boost::multi_index index by function call with parameter(s)

I'm trying to make a boost::multi_index container that uses member functions w/ parameters as keys. class Data { public: std::string get(const std::string & _attr) { return _internals_fetch_data(_attr); } /* assume some implementation for…
George Godik
  • 1,716
  • 1
  • 14
  • 19
0
votes
1 answer

C++:How to have an array of boost::multi_array

Hi I have a few boost::multi_array defined as below: typedef boost::multi_array region_prior_integral_image I am trying to create an array of region_prior_integral_image like the following: unordered_map
Aly
  • 15,865
  • 47
  • 119
  • 191