This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 1308 - deduced conflicting types for parameter 'IndexType' ('int' vs. 'long') in Core/ProductEvaluators.h
Summary: deduced conflicting types for parameter 'IndexType' ('int' vs. 'long') in Cor...
Status: RESOLVED FIXED
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - general (show other bugs)
Version: 3.3 (current stable)
Hardware: x86 - AVX Mac OS
: Normal Unknown
Assignee: Nobody
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-23 23:46 UTC by Linqing Feng
Modified: 2019-12-04 16:19 UTC (History)
3 users (show)



Attachments

Description Linqing Feng 2016-09-23 23:46:34 UTC
I got some conflicting deduced type (Eigen::Index and int literal) errors in Core/ProductEvaluators.h with the new version 3.3rc1:

/3rdparty/eigen/Eigen/src/Core/ProductEvaluators.h:621:29: error: no matching member function for call to 'packet'
    res = pmul(lhs.template packet<LoadMode,Packet>(row, 0), pset1<Packet>(rhs.coeff(0, col)));
/3rdparty/eigen/Eigen/src/Core/ProductEvaluators.h:268:30: error: no matching member function for call to 'coeff'
    func(dst.col(j), rhsEval.coeff(0,j) * actual_lhs);

Here is a small example to reproduce the error:

#include <Eigen>

int main()
{
  using MatrixXrt = Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic>;
  using VectorXrt = Eigen::Matrix<double, Eigen::Dynamic, 1>;
  using RowVectorXrt = Eigen::Matrix<double, 1, Eigen::Dynamic>;
  MatrixXrt tmp(20, 5);
  VectorXrt s = tmp.rowwise().sum();
  tmp = tmp.cwiseQuotient(s * RowVectorXrt::Ones(5));
}

Compile it with clang++ eigen_test.cpp -I/3rdparty/eigen/Eigen -std=c++14 -stdlib=libc++

In file included from eigen_test.cpp:1:
In file included from /3rdparty/eigen/Eigen/Eigen:1:
In file included from /3rdparty/eigen/Eigen/Dense:1:
In file included from /3rdparty/eigen/Eigen/Core:442:
/3rdparty/eigen/Eigen/src/Core/ProductEvaluators.h:268:30: error: 
      no matching member function for call to 'coeff'
    func(dst.col(j), rhsEval.coeff(0,j) * actual_lhs);
                     ~~~~~~~~^~~~~
/3rdparty/eigen/Eigen/src/Core/ProductEvaluators.h:305:15: note: 
      in instantiation of function template specialization
      'Eigen::internal::outer_product_selector_run<Eigen::Matrix<double, -1, -1,
      0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>,
      Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>,
      Eigen::Matrix<double, 1, -1, 1, 1, -1> >,
      Eigen::internal::generic_product_impl<Eigen::Matrix<double, -1, 1, 0, -1,
      1>, Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>,
      Eigen::Matrix<double, 1, -1, 1, 1, -1> >, Eigen::DenseShape,
      Eigen::DenseShape, 5>::set>' requested here
    internal::outer_product_selector_run(dst, lhs, rhs, set(), is_row_ma...
              ^
/3rdparty/eigen/Eigen/src/Core/ProductEvaluators.h:124:69: note: 
      in instantiation of function template specialization
      'Eigen::internal::generic_product_impl<Eigen::Matrix<double, -1, 1, 0, -1,
      1>, Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>,
      Eigen::Matrix<double, 1, -1, 1, 1, -1> >, Eigen::DenseShape,
      Eigen::DenseShape, 5>::evalTo<Eigen::Matrix<double, -1, -1, 0, -1, -1> >'
      requested here
    generic_product_impl<Lhs, Rhs, LhsShape, RhsShape, ProductTag>::evalTo(m...
                                                                    ^
/3rdparty/eigen/Eigen/src/Core/ProductEvaluators.h:35:62: note: 
      in instantiation of member function
      'Eigen::internal::product_evaluator<Eigen::Product<Eigen::Matrix<double,
      -1, 1, 0, -1, 1>,
      Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>,
      Eigen::Matrix<double, 1, -1, 1, 1, -1> >, 0>, 5, Eigen::DenseShape,
      Eigen::DenseShape, double, double>::product_evaluator' requested here
  EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) : Base(xpr) {}
                                                             ^
/3rdparty/eigen/Eigen/src/Core/CoreEvaluators.h:103:38: note: 
      in instantiation of member function
      'Eigen::internal::evaluator<Eigen::Product<Eigen::Matrix<double, -1, 1, 0,
      -1, 1>, Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>,
      Eigen::Matrix<double, 1, -1, 1, 1, -1> >, 0> >::evaluator' requested here
  explicit evaluator(const T& xpr) : evaluator<T>(xpr) {}
                                     ^
/3rdparty/eigen/Eigen/src/Core/CoreEvaluators.h:702:7: note: 
      in instantiation of member function 'Eigen::internal::evaluator<const
      Eigen::Product<Eigen::Matrix<double, -1, 1, 0, -1, 1>,
      Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>,
      Eigen::Matrix<double, 1, -1, 1, 1, -1> >, 0> >::evaluator' requested here
      m_rhsImpl(xpr.rhs())  
      ^
/3rdparty/eigen/Eigen/src/Core/CoreEvaluators.h:671:62: note: 
      (skipping 4 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see
      all)
  EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) : Base(xpr) {}
                                                             ^
/3rdparty/eigen/Eigen/src/Core/AssignEvaluator.h:776:3: note: 
      in instantiation of function template specialization
      'Eigen::internal::call_assignment_no_alias<Eigen::Matrix<double, -1, -1,
      0, -1, -1>,
      Eigen::CwiseBinaryOp<Eigen::internal::scalar_quotient_op<double, double>,
      const Eigen::Matrix<double, -1, -1, 0, -1, -1>, const
      Eigen::Product<Eigen::Matrix<double, -1, 1, 0, -1, 1>,
      Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>,
      Eigen::Matrix<double, 1, -1, 1, 1, -1> >, 0> >,
      Eigen::internal::assign_op<double, double> >' requested here
  call_assignment_no_alias(dst, src, func);
  ^
/3rdparty/eigen/Eigen/src/Core/AssignEvaluator.h:754:3: note: 
      in instantiation of function template specialization
      'Eigen::internal::call_assignment<Eigen::Matrix<double, -1, -1, 0, -1,
      -1>, Eigen::CwiseBinaryOp<Eigen::internal::scalar_quotient_op<double,
      double>, const Eigen::Matrix<double, -1, -1, 0, -1, -1>, const
      Eigen::Product<Eigen::Matrix<double, -1, 1, 0, -1, 1>,
      Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>,
      Eigen::Matrix<double, 1, -1, 1, 1, -1> >, 0> >,
      Eigen::internal::assign_op<double, double> >' requested here
  call_assignment(dst, src, internal::assign_op<typename Dst::Scalar,typ...
  ^
/3rdparty/eigen/Eigen/src/Core/PlainObjectBase.h:703:17: note: 
      in instantiation of function template specialization
      'Eigen::internal::call_assignment<Eigen::Matrix<double, -1, -1, 0, -1,
      -1>, Eigen::CwiseBinaryOp<Eigen::internal::scalar_quotient_op<double,
      double>, const Eigen::Matrix<double, -1, -1, 0, -1, -1>, const
      Eigen::Product<Eigen::Matrix<double, -1, 1, 0, -1, 1>,
      Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>,
      Eigen::Matrix<double, 1, -1, 1, 1, -1> >, 0> > >' requested here
      internal::call_assignment(this->derived(), other.derived());
                ^
/3rdparty/eigen/Eigen/src/Core/Matrix.h:225:20: note: 
      in instantiation of function template specialization
      'Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>
      >::_set<Eigen::CwiseBinaryOp<Eigen::internal::scalar_quotient_op<double,
      double>, const Eigen::Matrix<double, -1, -1, 0, -1, -1>, const
      Eigen::Product<Eigen::Matrix<double, -1, 1, 0, -1, 1>,
      Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>,
      Eigen::Matrix<double, 1, -1, 1, 1, -1> >, 0> > >' requested here
      return Base::_set(other);
                   ^
eigen_test.cpp:10:7: note: in instantiation of function template specialization
      'Eigen::Matrix<double, -1, -1, 0, -1,
      -1>::operator=<Eigen::CwiseBinaryOp<Eigen::internal::scalar_quotient_op<double,
      double>, const Eigen::Matrix<double, -1, -1, 0, -1, -1>, const
      Eigen::Product<Eigen::Matrix<double, -1, 1, 0, -1, 1>,
      Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>,
      Eigen::Matrix<double, 1, -1, 1, 1, -1> >, 0> > >' requested here
  tmp = tmp.cwiseQuotient(s * RowVectorXrt::Ones(5));
      ^
/3rdparty/eigen/Eigen/src/Core/CoreEvaluators.h:482:19: note: 
      candidate template ignored: deduced conflicting types for parameter
      'IndexType' ('int' vs. 'long')
  CoeffReturnType coeff(IndexType row, IndexType col) const
                  ^
/3rdparty/eigen/Eigen/src/Core/CoreEvaluators.h:489:19: note: 
      candidate function template not viable: requires single argument 'index',
      but 2 arguments were provided
  CoeffReturnType coeff(IndexType index) const
                  ^
1 error generated.

Thanks
Comment 1 Gael Guennebaud 2016-09-25 12:56:19 UTC
Thank you for the report.

Fixed:

https://bitbucket.org/eigen/eigen/commits/75fea0c86da1/
Changeset:   75fea0c86da1
User:        ggael
Date:        2016-09-25 12:54:35+00:00
Summary:     Bug 1308: fix compilation of vector * rowvector::nullary.


btw, better use "s.rowwise().replicate(5)"
Comment 2 Linqing Feng 2016-09-25 13:36:23 UTC
Thanks. Maybe line 621 and 612 of Core/ProductEvaluators.h need a similar fix, like 
res = pmul(lhs.template packet<LoadMode,Packet>(row, 0), pset1<Packet>(rhs.coeff(0, col)));
to
res = pmul(lhs.template packet<LoadMode,Packet>(row, Index(0)), pset1<Packet>(rhs.coeff(0, col)));

Here is the related error message:

/3rdparty/eigen/Eigen/src/Core/ProductEvaluators.h:621:29: error: no matching member function for call to 'packet'
    res = pmul(lhs.template packet<LoadMode,Packet>(row, 0), pset1<Packet>(rhs.coeff(0, col)));
               ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
/3rdparty/eigen/Eigen/src/Core/ProductEvaluators.h:545:17: note: in instantiation of member function 'Eigen::internal::etor_product_packet_impl<0, 1, Eigen::internal::evaluator<Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1> > >, Eigen::internal::evaluator<Eigen::Diagonal<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 0> >, __attribute__((__vector_size__(2 * sizeof(double)))) double, 16>::run' requested here
    PacketImpl::run(row, col, m_lhsImpl, m_rhsImpl, m_innerDim, res);
                ^
/3rdparty/eigen/Eigen/src/Core/ProductEvaluators.h:554:12: note: in instantiation of function template specialization 'Eigen::internal::product_evaluator<Eigen::Product<Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >, Eigen::Diagonal<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 0>, 1>, 3, Eigen::DenseShape, Eigen::DenseShape, double, double>::packet<16, __attribute__((__vector_size__(2 * sizeof(double)))) double>' requested here
    return packet<LoadMode,PacketType>(row,col);
           ^
......

/3rdparty/eigen/Eigen/src/Core/CoreEvaluators.h:496:14: note: candidate template ignored: deduced conflicting types for parameter 'IndexType' ('long' vs. 'int')
  PacketType packet(IndexType row, IndexType col) const
             ^
/3rdparty/eigen/Eigen/src/Core/CoreEvaluators.h:503:14: note: candidate function template not viable: requires single argument 'index', but 2 arguments were provided
  PacketType packet(IndexType index) const
Comment 3 Linqing Feng 2016-09-27 16:03:52 UTC
(In reply to Linqing Feng from comment #2)
> Thanks. Maybe line 621 and 612 of Core/ProductEvaluators.h need a similar
> fix, like 
> res = pmul(lhs.template packet<LoadMode,Packet>(row, 0),
> pset1<Packet>(rhs.coeff(0, col)));
> to
> res = pmul(lhs.template packet<LoadMode,Packet>(row, Index(0)),
> pset1<Packet>(rhs.coeff(0, col)));
> 

Line numbers should be 624 and 633.
Comment 4 Gael Guennebaud 2016-09-29 07:41:25 UTC
There were a few more:

https://bitbucket.org/eigen/eigen/commits/e8c837cc9c68/
Comment 5 Nobody 2019-12-04 16:19:22 UTC
-- 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/1308.

Note You need to log in before you can comment on or make changes to this bug.