How can I execute a mathematical operation between two boost::multi_arrays?
Example of adding two arrays with value type double:
auto array1 = boost::multi_array<double, 2>(boost::extents[10][10]);
auto array2 = boost::multi_array<double, 2>(boost::extents[10][10]);
auto array3 = array1 + array2; //Does not compile
One possibility I know is the Intel IPP library. Adding two matrices can be done with e.g. ippiAdd_. But Intel IPP does unfortunately not support double values for adding.
So does someone know another library than Intel IPP respectively a solution to overcome the shortcomings of restricted value types in Intel IPP?
You have to overload the
+operator for those your types of objectsboost::multi_array<double, 2>with your desired implementation.EDIT I just tried real-quick, apparently it was not so hard, but maybe needs more testing and review ;)
Here you go: