Closed pacman128 closed 5 years ago
The problem was with my code. I didn't include multi_math.hxx. The following code does compile:
#include <vigra/multi_array.hxx>
#include <vigra/multi_math.hxx> // This is required
void test()
{
using namespace vigra::multi_math;
vigra::MultiArray<2,float> i(vigra::Shape2(100,100)), j(vigra::Shape2(100,100));
vigra::MultiArray<2, float> h = i + 4.0 * j;
h += (i.transpose() - j) / 2.0;
}
The documentation could make this clearer.
The documentation (https://ukoethe.github.io/vigra/doc-release/vigra/group__MultiMathModule.html#details) states that the basic math operations are overloaded for the MultiArray types. However, the example code in the documentation does not compile:
as the compiler is unable to find any operator overloads for +, -, * and /. There are
+=
, ... methods defined for MultiArrayView and the Matrix type does have all the math overloads.Even the Matrix version of the above code doesn't work as it's written. I had to use float (not double) constants for it to compile:
Using float constants did not have any effect for the MultiArray code, even
h = i + j
fails for it.I see this problem on the Vigra version that is provided for Centos 7 which is 1.9.0 and the current version 1.11.1.