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
2
votes
1 answer

boost multiarray segmentation fault

I`m writing a code for which I'm using a 3 dimensional boost multiarray to save coordinates. But I always get a segmentation fault at some point. How are boost multiarray sizes limited and how can I get around those limits? Here is a simplified test…
Myrkjartan
  • 166
  • 3
  • 16
2
votes
2 answers

Using boost multi_array and its views in the same function

A multi_array view has many of the same methods as a multi_array. Do they have a common base that I can use by reference? void count(Type a) { // ^^^^ what should I use here? cout << a.num_elements() << endl; } int main() { …
cambunctious
  • 8,391
  • 5
  • 34
  • 53
2
votes
0 answers

Plotting Boost Multi-Array with gnuplot

I want to plot a multi-array I have created with the Boost library. I keep getting stuck inside my gnuplot-third party library (added in order to plot). Im having trouble sending the correct references from my multi-array I think. Here is my…
Trygve
  • 21
  • 2
2
votes
1 answer

boost::multi_array memory management and scope

I am using a boost::multi_array to store some data. I do all my work on the data using views, because I need to work with slices of the data in different dimensions. My question is, how is the memory of boost::multi_array managed? In particular, I…
Peter A
  • 227
  • 1
  • 9
2
votes
1 answer

How to construct a multi_array::index_gen at runtime

In the following code, the ExtractSubArray function is totally generic, while the ExtractSubArrayCornerAndExtent requires knowledge of the dimensionality at the time the code is written (to construct the sequence of RangeType arguments). Is there…
David Doria
  • 9,873
  • 17
  • 85
  • 147
2
votes
1 answer

Sorting boost's multi_array using sort function and a recursive comparator

I work on big data and program in c++. For example, I need to create 4-dimensional arrays of size [7 x 128^3 x 5 x 5] etc. I will have to create many more arrays as intermediate data structures for different properties. After researching a lot, I…
Jackson
  • 23
  • 4
2
votes
2 answers

resizing boost::multi_array to match another

I need to resize one multi_array to the size of another. In Blitz++ I could just do arr1.resize(arr2.shape()); Is there a multi_array solution of similar length? Because arr1.resize(boost::extents[arr2.shape()[0]][arr2.shape()[1]]); seems a little…
Cory
  • 151
  • 12
2
votes
1 answer

Container for boost::multi_array of same type but with different dimentionality

What i need is to create a class that can hold boost::multi_array of same type but with different dimentions assume there are one or more such arrays of Double boost::multi_array array_2d; //2D array boost::multi_array
2
votes
1 answer

Boost multiarray cannot vectorize warning

I am using Boost MultiArrays in Visual Studio 2013. I compiled Boost using the native x64 C++ compiler of Visual STudio. I am getting a lot of warnings of type 'info C5002'. Next to the warning, I also get the reason code for the warning. Here is…
2
votes
3 answers

boost multiarray of user defined class object

I need to describe a boost multiarray of two dimensions of object class that is myclass. Is it possible? or only is possible to define multiarray with standard types as int, double, etc.
2
votes
2 answers

Nesting boost::multi_array?

I have a template class which does some computation and returns multi_array, a bit oversimplified like this: template class C { public: typedef boost::multi_array result_type; void do_something(T const& data, unsigned i,…
Erwin411
  • 734
  • 1
  • 7
  • 14
2
votes
1 answer

Unable to initialize boost::multi_array unless T has a no-argument constructor

It seems that boost::multi_array requires that T have a no-argument constructor. Consider the following example. #include class ConstructorHasArguments { ConstructorHasArguments(int arg) {}; } int main() { …
Adam Paetznick
  • 195
  • 2
  • 5
2
votes
2 answers

Iterating over a Boost multi_array view

Is there a way to iterate over all the elements of a view into a Boost multi_array? It's clear how to iterate over a Boost multi_array; namely, go over the range [array.data(), array.data() + array.num_elements()). But if I create a view into this…
foxcub
  • 2,517
  • 2
  • 27
  • 27
2
votes
1 answer

Express stride in bytes in boost::multi_array

I have a two-dimensional native C array which was read as shorts, and I wish to map a boost::multi_array_ref onto part of it, but express this as floats. Is there a way to set the stride in bytes (rather than multiples of the data size)?
DAmann
  • 174
  • 7
1
vote
1 answer

Boost Signed/Unsigned Comparsion of size_type and index of multi_array

I'm using a boost::multi_array and when I need to check if a given coordinate is within bounds, I do this: bool MapData::IsWithinBounds(TileArray3D::index x, TileArray3D::index y, TileArray3D::index z) const { return (x >= 0 and x < GetWidth())…
Ell
  • 4,238
  • 6
  • 34
  • 60