From Marcos.h: #define EIGEN_WORLD_VERSION 3 #define EIGEN_MAJOR_VERSION 2 #define EIGEN_MINOR_VERSION 94 The following code segfaults on Mac OSx: #include <Eigen/Core> #include <unsupported/Eigen/CXX11/Tensor> #include <iostream> #include <array> using namespace Eigen; using namespace std; int main() { Eigen::Tensor<double, 1> tensor(5); Eigen::Tensor<double, 1> tensor2(5); tensor.setConstant(1); tensor2.setConstant(2); tensor(1) = 1; tensor2(1) = 2; std::array<Eigen::IndexPair<int>, 1> product_dims = { IndexPair<int>(0, 0) }; Eigen::Tensor<double, 1> tensor3(1); tensor3.setConstant(0); auto v = tensor.contract(tensor2, product_dims); cerr<<v<<endl; tensor3 = v; cerr<<tensor3<<endl; } it doesn't reach the second print command, and segfaults on tensor3 = v. On Linux it works fine (prints 10 twice). The version of g++ it segfaults on: g++ (GCC) 5.0.0 20141005 (experimental) Copyright (C) 2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Command used to compile: g++ 1.cpp -std=c++0x -I/eigenpath/eigen If you have any hints how to overcome this on Mac OSx with that g++ version it will be greatly appreciated.
I'm not expert of the Tensor module, but I think you have to use tensor of dimension 0 for tensor3: Eigen::Tensor<double, 0> tensor3; Nonetheless, this needs to be clarified. Either by triggering a static assertion or by allowing tensor of dim 1 for that.
-- GitLab Migration Automatic Message -- This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1341.