111 questions
2
votes
1
answer
120
views
How to delete the first rows/columns in a boost::multi_array?
It is very easy to delete the last rows or columns in a boost::multi_array, for example, using the following minimal example:
#include "boost/multi_array.hpp"
#include <iostream>
...
2
votes
2
answers
225
views
Unable to see gains on using boost::multi_array as compared to raw C array of pointers or C++ vector<vector<double>>
I am running a simple benchmarking exercise of 2d array access of reading and writing.
I have const int XDim = 1000; and const int YDim = 1000; and create a 1000 x 1000 matrix.
In C-style, I ...
1
vote
1
answer
178
views
How to change type of elements in C++ boost multi array?
I receive a matrix with elements of type unsigned char from another function and I am trying to find its max value.
boost::multi_array<unsigned char, 2> matrix;
All elements are integers and so ...
1
vote
1
answer
293
views
How to store values in the boost multi_array container?
I'm struggling to access the values and store them in boost multi_array container. I've tried to access the elements using the indexing methods ([] and .at()), but throws error: no matching function ...
1
vote
1
answer
341
views
boost::multi_array_ref vs. boost::multi_array&
Is there a reason to prefere the usage of boost::multi_array_ref over boost::multi_array&? Why is the adapter class boost::multi_array_ref provided by boost at all?
1
vote
1
answer
116
views
Copy selected values (via view) from boost::multi_array to another array (C++)
How can I copy (deep-copy) a selcted range (view) from a boost::multi_array to another array?
2
votes
1
answer
455
views
How to take subarray from 2d Boost.MultiArray?
I am working on a program where I need to use 2d Boost.MultiArray. I managed to initialize it and fill it with data. But I don't understand how to take subarray of size i,j if multiarray is of size m,...
1
vote
2
answers
217
views
How do I get a view of a boost multi_array and assign it back to the same boost multi_array?
I have a function called DataView that performs the "slicing" (creation of the array_view) as follows:
template <class T>
typename Boost<T>::Array2D::template array_view<2>::type ...
2
votes
1
answer
83
views
Does boost::multi_array default initialize its contents?
std::vector<T> foo(100) initialises every element with the default value for T. Does boost::multi_array<T, 2> foo(boost::extents[10][10]) do the same?
4
votes
1
answer
103
views
c++ boost::multi_array index too large
I'm using a two-dimensional boost::multi_array to store objects of a custom struct. The problem is that I have a huge amount of these objects so that the index of the array I would need exceeds the ...
6
votes
3
answers
1k
views
What is the type of a boost::extent object after providing dimensions?
Say I have
#include <boost/multi_array.hpp>
using intArray3D = boost::multi_array<int, 3>;
and I want to create a bunch of intArray3Ds with the same shape:
auto my_shape = boost::...
2
votes
1
answer
280
views
Passing boost::multi_array between functions (c++)
Suppose i need a five-dimensional array as class member and want to use it in different functions. For this puropose I use boost::multi_array e.g.:
class myClass {
typedef boost::multiarray<...
7
votes
1
answer
552
views
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 ...
0
votes
0
answers
49
views
boost multi array typedef not recognized c++ [duplicate]
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 "...
3
votes
2
answers
117
views
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 ...
2
votes
1
answer
468
views
multi_array_view assignment without deep copy?
How can I reassign a boost multi_array_view to point to a different part of a multi_array? I don't want a deep copy.
boost::multi_array<int, 2> a(...);
array_view b = a[indices[index_range(0, 5)...
2
votes
1
answer
100
views
(c++) Storing lambda function in a boost multi_array
My plan is to store hundreds (or even thousands) of (interpolation) functions in the multidimensional array multi_array from the boost library. I need to store them, since I need to call them at ...
3
votes
1
answer
119
views
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 ...
3
votes
1
answer
311
views
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 ...
0
votes
1
answer
442
views
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). ...
2
votes
0
answers
128
views
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 ...
4
votes
1
answer
948
views
clean way to initialize boost::multi_array with actual elements
I'm looking for clean syntactic sugar to initialize a boost::multi_array from explicit values. The best I could come up with was
double g[5][5] = {
{-0.0009 , 0.003799 , 0.00666 , 0.00374 ...
3
votes
2
answers
1k
views
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::...
5
votes
2
answers
5k
views
How to properly initialize a boost multi_array of objects?
I have been surprised to find that boost::multi_array seems to allocate its initial elements differently from, say, std::vector. It does not seem to fill each element with a unique element (using its ...
2
votes
1
answer
160
views
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<double, 2> ...