[eigen] "overloaded operator '*' is ambiguous..." in Eigen 3.3 ffa8356

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hi all,

First, thanks Gael for fixing the last bug! I missed the notification from the list when you first posted it.

On to the current bug. I want to apologize: I don't have a minimal working example demonstrating this issue. It would help me to figure out how to trap / create a minimal example out of this for future reference.

I'm using the Stan Math library (https://github.com/stan-dev/math.git) on this branch: feature/0187-eigen-3.3

The example I'm working with right now is this and it fails to compile (if you put this in test/tmp_test.cpp, it's easy to run using: ./runTests.py test/tmp_test.cpp).

#include <stan/math/fwd/mat.hpp>
#include <gtest/gtest.h>


TEST(int, main) {
  Eigen::Matrix<stan::math::fvar<double>, Eigen::Dynamic, Eigen::Dynamic> m(2, 2);
  m << 4, 1, 1, 4;

  Eigen::LLT<Eigen::Matrix<stan::math::fvar<double>, Eigen::Dynamic, Eigen::Dynamic> >
    llt(m.rows());
  llt.compute(m);
}


That last line, llt.compute(m), creates a slew of compiler messages. Any suggestions on how to trap this? This code works with Eigen 3.2.9. The only things that changed within the Stan Math library pertaining to the type stan::math::fvar<double> is the implementation of static int digits10() for printing.

clang++ -I . -isystem lib/eigen_3.3.ffa8356 -isystem lib/boost_1.60.0 -isystemlib/cvodes_2.9.0/include -Wall -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DNO_FPRINTF_OUTPUT -pipe -I/usr/local/opt/llvm/include -Wno-unknown-warning-option -Wno-unused-function -Wno-tautological-compare -Wno-c++11-long-long -Wsign-compare -Wno-unused-local-typedef -ftemplate-depth=256   -c -O3 -DGTEST_USE_OWN_TR1_TUPLE -Wc++11-extensions -Wno-c++11-long-long -isystem lib/gtest_1.7.0/include -isystem lib/gtest_1.7.0 test/tmp_test.cpp -o test/tmp_test.o
In file included from test/tmp_test.cpp:2:
In file included from ./stan/math/fwd/mat.hpp:8:
In file included from ./stan/math/fwd/mat/vectorize/apply_scalar_unary.hpp:4:
In file included from ./stan/math/prim/mat/vectorize/apply_scalar_unary.hpp:4:
In file included from lib/eigen_3.3.ffa8356/Eigen/Dense:3:
In file included from lib/eigen_3.3.ffa8356/Eigen/Cholesky:31:
lib/eigen_3.3.ffa8356/Eigen/src/Cholesky/LLT.h:321:45: error: use of overloaded operator '*' is
      ambiguous (with operand types 'Block<Eigen::Matrix<stan::math::fvar<double>, -1, -1, 0, -1,
      -1>, Dynamic, Dynamic>' and 'const AdjointReturnType' (aka 'const Eigen::Transpose<const
      Eigen::Block<Eigen::Matrix<stan::math::fvar<double>, -1, -1, 0, -1, -1>, 1, -1, false> >'))
      if (k>0 && rs>0) A21.noalias() -= A20 * A10.adjoint();
                                        ~~~ ^ ~~~~~~~~~~~~~
lib/eigen_3.3.ffa8356/Eigen/src/Cholesky/LLT.h:333:14: note: in instantiation of function template
      specialization 'Eigen::internal::llt_inplace<stan::math::fvar<double>,
      1>::unblocked<Eigen::Matrix<stan::math::fvar<double>, -1, -1, 0, -1, -1> >' requested here
      return unblocked(m);
             ^
lib/eigen_3.3.ffa8356/Eigen/src/Cholesky/LLT.h:397:61: note: in instantiation of function template
      specialization 'Eigen::internal::llt_inplace<stan::math::fvar<double>,
      1>::blocked<Eigen::Matrix<stan::math::fvar<double>, -1, -1, 0, -1, -1> >' requested here
  { return llt_inplace<typename MatrixType::Scalar, Lower>::blocked(m)==-1; }
                                                            ^
lib/eigen_3.3.ffa8356/Eigen/src/Cholesky/LLT.h:444:21: note: in instantiation of member function
      'Eigen::internal::LLT_Traits<Eigen::Matrix<stan::math::fvar<double>, -1, -1, 0, -1, -1>,
      1>::inplace_decomposition' requested here
  bool ok = Traits::inplace_decomposition(m_matrix);
                    ^
test/tmp_test.cpp:12:7: note: in instantiation of function template specialization
      'Eigen::LLT<Eigen::Matrix<stan::math::fvar<double>, -1, -1, 0, -1, -1>,
      1>::compute<Eigen::Matrix<stan::math::fvar<double>, -1, -1, 0, -1, -1> >' requested here
  llt.compute(m);
      ^
lib/eigen_3.3.ffa8356/Eigen/src/SparseCore/../plugins/CommonCwiseBinaryOps.h:50:29: note: candidate
      function [with T = Eigen::Block<Eigen::Matrix<stan::math::fvar<double>, -1, -1, 0, -1, -1>, -1,
      -1, false>]
EIGEN_MAKE_SCALAR_BINARY_OP(operator*,product)
                            ^
lib/eigen_3.3.ffa8356/Eigen/src/SparseCore/../plugins/CommonCwiseBinaryOps.h:50:29: note: candidate
      function [with T = Eigen::Transpose<const Eigen::Block<Eigen::Matrix<stan::math::fvar<double>,
      -1, -1, 0, -1, -1>, 1, -1, false> >]
lib/eigen_3.3.ffa8356/Eigen/src/Core/MatrixBase.h:173:5: note: candidate function [with OtherDerived
      = Eigen::Transpose<const Eigen::Block<Eigen::Matrix<stan::math::fvar<double>, -1, -1, 0, -1,
      -1>, 1, -1, false> >]
    operator*(const MatrixBase<OtherDerived> &other) const;
    ^
In file included from test/tmp_test.cpp:2:
In file included from ./stan/math/fwd/mat.hpp:8:
In file included from ./stan/math/fwd/mat/vectorize/apply_scalar_unary.hpp:4:
In file included from ./stan/math/prim/mat/vectorize/apply_scalar_unary.hpp:4:
In file included from lib/eigen_3.3.ffa8356/Eigen/Dense:3:
In file included from lib/eigen_3.3.ffa8356/Eigen/Cholesky:31:
lib/eigen_3.3.ffa8356/Eigen/src/Cholesky/LLT.h:321:45: error: use of overloaded operator '*' is
      ambiguous (with operand types 'Block<Eigen::Block<Eigen::Matrix<stan::math::fvar<double>, -1,
      -1, 0, -1, -1>, -1, -1, false>, Dynamic, Dynamic>' and 'const AdjointReturnType' (aka 'const
      Eigen::Transpose<const Eigen::Block<Eigen::Block<Eigen::Matrix<stan::math::fvar<double>, -1,
      -1, 0, -1, -1>, -1, -1, false>, 1, -1, false> >'))
      if (k>0 && rs>0) A21.noalias() -= A20 * A10.adjoint();
                                        ~~~ ^ ~~~~~~~~~~~~~
lib/eigen_3.3.ffa8356/Eigen/src/Cholesky/LLT.h:352:15: note: in instantiation of function template
      specialization 'Eigen::internal::llt_inplace<stan::math::fvar<double>,
      1>::unblocked<Eigen::Block<Eigen::Matrix<stan::math::fvar<double>, -1, -1, 0, -1, -1>, -1, -1,
      false> >' requested here
      if((ret=unblocked(A11))>=0) return k+ret;
              ^
lib/eigen_3.3.ffa8356/Eigen/src/Cholesky/LLT.h:397:61: note: in instantiation of function template
      specialization 'Eigen::internal::llt_inplace<stan::math::fvar<double>,
      1>::blocked<Eigen::Matrix<stan::math::fvar<double>, -1, -1, 0, -1, -1> >' requested here
  { return llt_inplace<typename MatrixType::Scalar, Lower>::blocked(m)==-1; }
                                                            ^
lib/eigen_3.3.ffa8356/Eigen/src/Cholesky/LLT.h:444:21: note: in instantiation of member function
      'Eigen::internal::LLT_Traits<Eigen::Matrix<stan::math::fvar<double>, -1, -1, 0, -1, -1>,
      1>::inplace_decomposition' requested here
  bool ok = Traits::inplace_decomposition(m_matrix);
                    ^
test/tmp_test.cpp:12:7: note: in instantiation of function template specialization
      'Eigen::LLT<Eigen::Matrix<stan::math::fvar<double>, -1, -1, 0, -1, -1>,
      1>::compute<Eigen::Matrix<stan::math::fvar<double>, -1, -1, 0, -1, -1> >' requested here
  llt.compute(m);
      ^
lib/eigen_3.3.ffa8356/Eigen/src/SparseCore/../plugins/CommonCwiseBinaryOps.h:50:29: note: candidate
      function [with T = Eigen::Block<Eigen::Block<Eigen::Matrix<stan::math::fvar<double>, -1, -1, 0,
      -1, -1>, -1, -1, false>, -1, -1, false>]
EIGEN_MAKE_SCALAR_BINARY_OP(operator*,product)
                            ^
lib/eigen_3.3.ffa8356/Eigen/src/SparseCore/../plugins/CommonCwiseBinaryOps.h:50:29: note: candidate
      function [with T = Eigen::Transpose<const
      Eigen::Block<Eigen::Block<Eigen::Matrix<stan::math::fvar<double>, -1, -1, 0, -1, -1>, -1, -1,
      false>, 1, -1, false> >]
lib/eigen_3.3.ffa8356/Eigen/src/Core/MatrixBase.h:173:5: note: candidate function [with OtherDerived
      = Eigen::Transpose<const Eigen::Block<Eigen::Block<Eigen::Matrix<stan::math::fvar<double>, -1,
      -1, 0, -1, -1>, -1, -1, false>, 1, -1, false> >]
    operator*(const MatrixBase<OtherDerived> &other) const;
    ^
2 errors generated.
make: *** [test/tmp_test.o] Error 1
make test/tmp_test failed
exit now (10/31/16 11:04:33 EDT)






Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/