The following code snippet compiled fine in version 3.1.4, but it doesn't compile on upgrade to 3.2.4. w.noalias() = A.middleRows(i, n) * A.row(j).transpose(); In this case, w is a VectorXf type and A is a MatrixXf type. It fails compiling with /local/include\/Eigen/src/Core/products/CoeffBasedProduct.h:282:131: error: template instantiation depth exceeds maximum of 900 (use -ftemplate-depth= to increase the maximum) substituting ‘template<int LoadMode> Eigen::MapBase<Derived, 0>::PacketScalar Eigen::MapBase<Derived, 0>::packet(Eigen::MapBase<Derived, 0>::Index) const [with int LoadMode = 1]’ pres = padd(pres, pmul( lhs.template packet<Aligned>(row, UnrollingIndex) , rhs.template packet<Aligned>(UnrollingIndex, col) )); ^ /local/include/Eigen/src/Core/products/CoeffBasedProduct.h:282:131: required from ‘static void Eigen::internal::product_coeff_vectorized_unroller<UnrollingIndex, Lhs, Rhs, Packet>::run(Eigen::internal::product_coeff_vectorized_unroller<UnrollingIndex, Lhs, Rhs, Packet>::Index, Eigen::internal::product_coeff_vectorized_unroller<UnrollingIndex, Lhs, Rhs, Packet>::Index, const Lhs&, const Rhs&, typename Lhs::PacketScalar&) [with int UnrollingIndex = -3555; Lhs = Eigen::Block<const Eigen::Matrix<float, -1, 0, 1, -1, 0>, -1, 0, true>; Rhs = Eigen::Block<const Eigen::Transpose<const Eigen::Matrix<float, -1, 0, 1, -1, 0> >, 0, 1, true>; Packet = __vector(4) float; Eigen::internal::product_coeff_vectorized_unroller<UnrollingIndex, Lhs, Rhs, Packet>::Index = long int; typename Lhs::PacketScalar = __vector(4) float]’ /local/include/Eigen/src/Core/products/CoeffBasedProduct.h:281:113: [ skipping 3 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ] /local/include/Eigen/src/Core/products/CoeffBasedProduct.h:281:113: recursively required from ‘static void Eigen::internal::product_coeff_vectorized_unroller<UnrollingIndex, Lhs, Rhs, Packet>::run(Eigen::internal::product_coeff_vectorized_unroller<UnrollingIndex, Lhs, Rhs, Packet>::Index, Eigen::internal::product_coeff_vectorized_unroller<UnrollingIndex, Lhs, Rhs, Packet>::Index, const Lhs&, const Rhs&, typename Lhs::PacketScalar&) [with int UnrollingIndex = -7; Lhs = Eigen::Block<const Eigen::Matrix<float, -1, 0, 1, -1, 0>, -1, 0, true>; Rhs = Eigen::Block<const Eigen::Transpose<const Eigen::Matrix<float, -1, 0, 1, -1, 0> >, 0, 1, true>; Packet = __vector(4) float; Eigen::internal::product_coeff_vectorized_unroller<UnrollingIndex, Lhs, Rhs, Packet>::Index = long int; typename Lhs::PacketScalar = __vector(4) float]’ /local/include/Eigen/src/Core/products/CoeffBasedProduct.h:281:113: required from ‘static void Eigen::internal::product_coeff_vectorized_unroller<UnrollingIndex, Lhs, Rhs, Packet>::run(Eigen::internal::product_coeff_vectorized_unroller<UnrollingIndex, Lhs, Rhs, Packet>::Index, Eigen::internal::product_coeff_vectorized_unroller<UnrollingIndex, Lhs, Rhs, Packet>::Index, const Lhs&, const Rhs&, typename Lhs::PacketScalar&) [with int UnrollingIndex = -3; Lhs = Eigen::Block<const Eigen::Matrix<float, -1, 0, 1, -1, 0>, -1, 0, true>; Rhs = Eigen::Block<const Eigen::Transpose<const Eigen::Matrix<float, -1, 0, 1, -1, 0> >, 0, 1, true>; Packet = __vector(4) float; Eigen::internal::product_coeff_vectorized_unroller<UnrollingIndex, Lhs, Rhs, Packet>::Index = long int; typename Lhs::PacketScalar = __vector(4) float]’ /local/include/Eigen/src/Core/products/CoeffBasedProduct.h:305:115: required from ‘static void Eigen::internal::product_coeff_impl<2, UnrollingIndex, Lhs, Rhs, RetScalar>::run(Eigen::internal::product_coeff_impl<2, UnrollingIndex, Lhs, Rhs, RetScalar>::Index, Eigen::internal::product_coeff_impl<2, UnrollingIndex, Lhs, Rhs, RetScalar>::Index, const Lhs&, const Rhs&, RetScalar&) [with int UnrollingIndex = 0; Lhs = Eigen::Block<const Eigen::Matrix<float, -1, 0, 1, -1, 0>, -1, 0, true>; Rhs = Eigen::Block<const Eigen::Transpose<const Eigen::Matrix<float, -1, 0, 1, -1, 0> >, 0, 1, true>; RetScalar = float; Eigen::internal::product_coeff_impl<2, UnrollingIndex, Lhs, Rhs, RetScalar>::Index = long int]’ I'm using g++ 4.9, with c++11 enabled.
Can you please provide a minimal example? The following compiled fine for me, for both 3.2.4 and 3.2-head: #include <Eigen/Core> EIGEN_DONT_INLINE void test(Eigen::VectorXf& w, const Eigen::MatrixXf& A, int i, int j, int n) { w.noalias() = A.middleRows(i, n) * A.row(j).transpose(); } From your error message it looks as if the type of A is actually: Eigen::Matrix<float, -1, 0, 1, -1, 0> which does not really make sense (Cols=0 but MaxColsAtCompileTime=Dynamic should IMO give a static assertion) but still does compile at my machine. I only tested g++ 4.7 and 4.8, however. Are you sure your Eigen version has not been modified somehow? Or perhaps you have some #define which corrupts Eigen's behavior.
Yes, I apologize -- this was inside of a templated function, so it was not MatrixXf as noted. The following code gives me the error above. The use case is that we use a fixed column size of 0 to essentially disable some parts of our algorithm. static void test_f() { // Compiles fine in 3.1.4, fails compilation in 3.2.4 Eigen::Matrix<float, Eigen::Dynamic, 0, Eigen::RowMajor> V; Eigen::Matrix<float, -1, 1> w; V.resize(1000, 0); w.noalias() = V.middleRows(0,500) * V.row(501).transpose(); }
Confirmed and fixed: https://bitbucket.org/eigen/eigen/commits/a8957c419535/ Changeset: a8957c419535 Branch: 3.2 User: ggael Date: 2015-02-28 14:25:39+00:00 Summary: Fix bug 972: allow coeff-based products of depth 0 and remove a useless statement in coeff-based product. This was already fixed in the devel branch.
-- 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/972.