Re: [eigen] DenseCoeffsBase

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


FYI

I'm getting a compile error in some code that looks related to this that popped up after this latest commit. Maybe just a complex piece is missing? ...maybe I'm doing something wrong.

I can piece together a minimal example if needed, but maybe the problem is obvious to you from the error?

Thanks,
Trevor

g++ -o src/receiverpoints.os -c -O3 -Wall -Wno-long-long -DNDEBUG -Werror -Wfatal-errors -msse -fPIC -DLEMMAUSEVTK -Wno-deprecated -fopenmp -DLEMMAUSEOMP -I/home/tirons/src/eigen -Iinclude -I/usr/include/vtk-5.4 src/receiverpoints.cpp
In file included from /home/tirons/src/eigen/Eigen/Core:257:0,
                 from include/lemma.h:110,
                 from include/referencecountedobject.h:37,
                 from include/receiverpoints.h:50,
                 from src/receiverpoints.cpp:34:
/home/tirons/src/eigen/Eigen/src/Core/CwiseUnaryView.h: In member function 'Eigen::CwiseUnaryViewImpl<ViewOp, MatrixType, Eigen::Dense>::CoeffReturnType Eigen::CwiseUnaryViewImpl<ViewOp, MatrixType, Eigen::Dense>::coeff(int) const [with ViewOp = Eigen::ei_scalar_imag_ref_op<std::complex<double> >, MatrixType = Eigen::Matrix<std::complex<double>, 3, 1>, Eigen::CwiseUnaryViewImpl<ViewOp, MatrixType, Eigen::Dense>::CoeffReturnType = const double&]':
/home/tirons/src/eigen/Eigen/src/Core/CwiseUnaryOp.h:124:75:   instantiated from 'Eigen::CwiseUnaryOpImpl<UnaryOp, XprType, Eigen::Dense>::Scalar Eigen::CwiseUnaryOpImpl<UnaryOp, XprType, Eigen::Dense>::coeff(int) const [with UnaryOp = Eigen::ei_scalar_multiple_op<double>, XprType = Eigen::CwiseUnaryView<Eigen::ei_scalar_imag_ref_op<std::complex<double> >, Eigen::Matrix<std::complex<double>, 3, 1> >, Eigen::CwiseUnaryOpImpl<UnaryOp, XprType, Eigen::Dense>::Scalar = double]'
/home/tirons/src/eigen/Eigen/src/Core/DenseCoeffsBase.h:450:7:   instantiated from 'void Eigen::DenseCoeffsBase<Derived, true>::copyCoeff(int, const Eigen::DenseBase<OtherDerived>&) [with OtherDerived = Eigen::CwiseUnaryOp<Eigen::ei_scalar_multiple_op<double>, Eigen::CwiseUnaryView<Eigen::ei_scalar_imag_ref_op<std::complex<double> >, Eigen::Matrix<std::complex<double>, 3, 1> > >, Derived = Eigen::Matrix<double, 3, 1>]'
/home/tirons/src/eigen/Eigen/src/Core/Assign.h:186:5:   instantiated from 'static void Eigen::ei_assign_LinearTraversal_CompleteUnrolling<Derived1, Derived2, Index, Stop>::run(Derived1&, const Derived2&) [with Derived1 = Eigen::Matrix<double, 3, 1>, Derived2 = Eigen::CwiseUnaryOp<Eigen::ei_scalar_multiple_op<double>, Eigen::CwiseUnaryView<Eigen::ei_scalar_imag_ref_op<std::complex<double> >, Eigen::Matrix<std::complex<double>, 3, 1> > >, int Index = 0, int Stop = 3]'
/home/tirons/src/eigen/Eigen/src/Core/Assign.h:309:5:   instantiated from 'static void Eigen::ei_assign_impl<Derived1, Derived2, 1, 2>::run(Derived1&, const Derived2&) [with Derived1 = Eigen::Matrix<double, 3, 1>, Derived2 = Eigen::CwiseUnaryOp<Eigen::ei_scalar_multiple_op<double>, Eigen::CwiseUnaryView<Eigen::ei_scalar_imag_ref_op<std::complex<double> >, Eigen::Matrix<std::complex<double>, 3, 1> > >]'
/home/tirons/src/eigen/Eigen/src/Core/Assign.h:472:3:   instantiated from 'Derived& Eigen::DenseBase<Derived>::lazyAssign(const Eigen::DenseBase<OtherDerived>&) [with OtherDerived = Eigen::CwiseUnaryOp<Eigen::ei_scalar_multiple_op<double>, Eigen::CwiseUnaryView<Eigen::ei_scalar_imag_ref_op<std::complex<double> >, Eigen::Matrix<std::complex<double>, 3, 1> > >, Derived = Eigen::Matrix<double, 3, 1>]'
/home/tirons/src/eigen/Eigen/src/Core/DenseStorageBase.h:306:46:   instantiated from 'Derived& Eigen::DenseStorageBase<Derived>::lazyAssign(const Eigen::DenseBase<OtherDerived>&) [with OtherDerived = Eigen::CwiseUnaryOp<Eigen::ei_scalar_multiple_op<double>, Eigen::CwiseUnaryView<Eigen::ei_scalar_imag_ref_op<std::complex<double> >, Eigen::Matrix<std::complex<double>, 3, 1> > >, Derived = Eigen::Matrix<double, 3, 1>]'
/home/tirons/src/eigen/Eigen/src/Core/Assign.h:492:123:   instantiated from 'static Derived& Eigen::ei_assign_selector<Derived, OtherDerived, false, false>::run(Derived&, const OtherDerived&) [with Derived = Eigen::Matrix<double, 3, 1>, OtherDerived = Eigen::CwiseUnaryOp<Eigen::ei_scalar_multiple_op<double>, Eigen::CwiseUnaryView<Eigen::ei_scalar_imag_ref_op<std::complex<double> >, Eigen::Matrix<std::complex<double>, 3, 1> > >]'
/home/tirons/src/eigen/Eigen/src/Core/DenseStorageBase.h:473:98:   instantiated from 'Derived& Eigen::DenseStorageBase<Derived>::_set_noalias(const Eigen::DenseBase<OtherDerived>&) [with OtherDerived = Eigen::CwiseUnaryOp<Eigen::ei_scalar_multiple_op<double>, Eigen::CwiseUnaryView<Eigen::ei_scalar_imag_ref_op<std::complex<double> >, Eigen::Matrix<std::complex<double>, 3, 1> > >, Derived = Eigen::Matrix<double, 3, 1>]'
/home/tirons/src/eigen/Eigen/src/Core/DenseStorageBase.h:460:95:   instantiated from 'void Eigen::DenseStorageBase<Derived>::_set_selector(const OtherDerived&, const Eigen::ei_meta_false&) [with OtherDerived = Eigen::CwiseUnaryOp<Eigen::ei_scalar_multiple_op<double>, Eigen::CwiseUnaryView<Eigen::ei_scalar_imag_ref_op<std::complex<double> >, Eigen::Matrix<std::complex<double>, 3, 1> > >, Derived = Eigen::Matrix<double, 3, 1>]'
/home/tirons/src/eigen/Eigen/src/Core/DenseStorageBase.h:452:7:   instantiated from 'Derived& Eigen::DenseStorageBase<Derived>::_set(const Eigen::DenseBase<OtherDerived>&) [with OtherDerived = Eigen::CwiseUnaryOp<Eigen::ei_scalar_multiple_op<double>, Eigen::CwiseUnaryView<Eigen::ei_scalar_imag_ref_op<std::complex<double> >, Eigen::Matrix<std::complex<double>, 3, 1> > >, Derived = Eigen::Matrix<double, 3, 1>]'
/home/tirons/src/eigen/Eigen/src/Core/Matrix.h:180:30:   instantiated from 'Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>& Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::operator=(const Eigen::MatrixBase<OtherDerived>&) [with OtherDerived = Eigen::CwiseUnaryOp<Eigen::ei_scalar_multiple_op<double>, Eigen::CwiseUnaryView<Eigen::ei_scalar_imag_ref_op<std::complex<double> >, Eigen::Matrix<std::complex<double>, 3, 1> > >, _Scalar = double, int _Rows = 3, int _Cols = 1, int _Options = 0, int _MaxRows = 3, int _MaxCols = 1, Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> = Eigen::Matrix<double, 3, 1>]'
src/receiverpoints.cpp:204:46:   instantiated from here
/home/tirons/src/eigen/Eigen/src/Core/CwiseUnaryView.h:126:75: error: no match for call to '(const Eigen::ei_scalar_imag_ref_op<std::complex<double> >) (const Eigen::DenseStorageBase<Eigen::Matrix<std::complex<double>, 3, 1> >::Scalar&)'
compilation terminated due to -Wfatal-errors.



On 8 May 2010 14:08, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:
Hi,

This is to explain the group of commits that I just made in the dev branch.

maybe you remember, not long ago, i was playing with the idea of
adding a DenseDirectAccessBase class, then gave up... well the idea is
back and this time I believe it's correctly implemented. See class
DenseCoeffsBase.

Here's a quick rationalization:

We used to have a lot of methods in DenseBase that only made sense in
the DirectAccess case. Like coeffRef(), writePacket(), copyCoeff(),
all the strides API...

That was bad of course (not to mention dangerous as they were trying
to call a method with same name in the derived class).

The "obvious" fix was to use enable_if on these methods, however
 - that would have been fiddling with their prototypes: better avoid
that if we can
 - a lot of methods were concerned, not just 1 or 2 methods.

The alternative of using a static assert was not very good here,
because e.g. operator() was overloaded with one variant using direct
access and not the other, so we'd be having issues with overload
resolution.

So instead, the idea is to introduce a new base class DenseCoeffsBase
in the hierarchy, implementing a "group enable_if". The methods
prototypes stay the same, they just move to the new base class.

Tell me if you have an objection against that.

Benoit





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