Re: [eigen] ei_pmul issues

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


Hi,

This error message means that you mixed together in a single
expression float's and double's. You can't do that, you must use
matrix.cast<float>() or matrix.cast<double>().

More specifically look at the innermost step:

> /home/benjamin/env/include/eigen2/Eigen/src/Core/Matrix.h:243:
> instantiated from ‘Eigen::Matrix<_Scalar, _Rows, _Cols, _StorageOrder,
> _MaxRows, _MaxCols>& Eigen::Matrix<_Scalar, _Rows, _Cols, _StorageOrder,
> _MaxRows, _MaxCols>::operator+=(const Eigen::MatrixBase<OtherDerived>&)
> [with OtherDerived = Eigen::Product<const Eigen::Map<Eigen::Matrix<float,
> 10000, 1, 0, 10000, 1>, 1>&, const
> Eigen::Transpose<Eigen::Block<Eigen::Matrix<double, 3, 10000, 0, 3, 10000>,
> 3, 1, 1, 32> >&, 0>, _Scalar = float, int _Rows = 10000, int _Cols = 10000,
> int _StorageOrder = 0, int _MaxRows = 10000, int _MaxCols = 10000]’
> /home/benjamin/eth/masterarbeit/viewer/libsph/SPHSampler.cpp:224:
> instantiated from here


This tells you that at line 224 in your file libsph/SPHSampler.cpp,
you are doiing an expression of the form

some_matrix * some_expression

and some_matrix has float coefficients while some_expression has
double coefficients.

The solution is to write

some_matrix * some_expression.cast<float>()

since anyway your error message tells us that you are storing the
result into a float matrix.

I realize that this is a very unhelpful error message, so we should
add compile-time logic to guard this and produce a nicer error message
if the types don't match (on my todo).

Cheers,
Benoit



2008/12/2 Benjamin Schindler <bschindler@xxxxxxxxxxxxxxx>:
> Hi
>
> I can't currently compile some code which compiles cleanly on another
> machine and I haven't been able to figure why...
>
> /home/benjamin/eth/masterarbeit/viewer/libsph/SPHSampler.cpp:222:
> instantiated from here
> /home/benjamin/env/include/eigen2/Eigen/src/Core/Product.h:465: error: no
> matching function for call to 'ei_pmul(float __vector__, double __vector__)'
> make[2]: *** [libsph/CMakeFiles/sph.dir/SPHSampler.cpp.o] Error 1
> make[2]: Leaving directory `/home/benjamin/software/build/viewer-build'
> make[1]: *** [libsph/CMakeFiles/sph.dir/all] Error 2
> make[1]: Leaving directory `/home/benjamin/software/build/viewer-build'
> make: *** [all] Error 2
>
> I attach the complete error. Any idea what's going wrong here? I'm compiling
> with gcc-4.3 with -msse2 -march=native, A pentium-m centrino. On the
> desktop, a core2 duo it compiles cleanly
> Oh, I'm using the latest eigen2 beta
>
> Thanks
> Benjamin
>
>
> [ 18%] Building CXX object libsph/CMakeFiles/sph.dir/SPHSampler.cpp.o
> cd /home/benjamin/software/build/viewer-build/libsph && /usr/bin/c++
>  -Dsph_EXPORTS   -Wno-deprecated -O2 -g -msse2 -march=native -DNDEBUG -fPIC
> -I/home/benjamin/env/include/vtk-5.2 -I/home/benjamin/env/include/eigen2
> -o CMakeFiles/sph.dir/SPHSampler.cpp.o -c
> /home/benjamin/eth/masterarbeit/viewer/libsph/SPHSampler.cpp
> /home/benjamin/env/include/eigen2/Eigen/src/Core/Product.h: In static member
> function ‘static void Eigen::ei_product_packet_impl<0, 0, Lhs, Rhs,
> PacketScalar, LoadMode>::run(int, int, const Lhs&, const Rhs&,
> PacketScalar&) [with Lhs = Eigen::Map<Eigen::Matrix<float, 10000, 1, 0,
> 10000, 1>, 1>, Rhs = Eigen::Transpose<Eigen::Block<Eigen::Matrix<double, 3,
> 10000, 0, 3, 10000>, 3, 1, 1, 32> >, PacketScalar = float __vector__, int
> LoadMode = 1]’:
> /home/benjamin/env/include/eigen2/Eigen/src/Core/Product.h:244:
> instantiated from ‘const typename
> Eigen::MatrixBase<Eigen::Product<LhsNested, RhsNested, ProductMode>
>>::PacketScalar Eigen::Product<Lhs, Rhs, ProductMode>::packet(int, int)
> const [with int LoadMode = 1, LhsNested = const
> Eigen::Map<Eigen::Matrix<float, 10000, 1, 0, 10000, 1>, 1>&, RhsNested =
> const Eigen::Transpose<Eigen::Block<Eigen::Matrix<double, 3, 10000, 0, 3,
> 10000>, 3, 1, 1, 32> >&, int ProductMode = 0]’
> /home/benjamin/env/include/eigen2/Eigen/src/Core/Coeffs.h:339:
> instantiated from ‘void Eigen::MatrixBase<Derived>::copyPacket(int, int,
> const Eigen::MatrixBase<OtherDerived>&) [with OtherDerived =
> Eigen::Product<const Eigen::Map<Eigen::Matrix<float, 10000, 1, 0, 10000, 1>,
> 1>&, const Eigen::Transpose<Eigen::Block<Eigen::Matrix<double, 3, 10000, 0,
> 3, 10000>, 3, 1, 1, 32> >&, 0>, int StoreMode = 0, int LoadMode = 1, Derived
> = Eigen::Matrix<float, 10000, 3, 0, 10000, 3>]’
> /home/benjamin/env/include/eigen2/Eigen/src/Core/Assign.h:375:
> instantiated from ‘static void Eigen::ei_assign_impl<Derived1, Derived2,
> 2, 2>::run(Derived1&, const Derived2&) [with Derived1 = Eigen::Matrix<float,
> 10000, 3, 0, 10000, 3>, Derived2 = Eigen::Product<const
> Eigen::Map<Eigen::Matrix<float, 10000, 1, 0, 10000, 1>, 1>&, const
> Eigen::Transpose<Eigen::Block<Eigen::Matrix<double, 3, 10000, 0, 3, 10000>,
> 3, 1, 1, 32> >&, 0>]’
> /home/benjamin/env/include/eigen2/Eigen/src/Core/Assign.h:405:
> instantiated from ‘Derived& Eigen::MatrixBase<Derived>::lazyAssign(const
> Eigen::MatrixBase<OtherDerived>&) [with OtherDerived = Eigen::Product<const
> Eigen::Map<Eigen::Matrix<float, 10000, 1, 0, 10000, 1>, 1>&, const
> Eigen::Transpose<Eigen::Block<Eigen::Matrix<double, 3, 10000, 0, 3, 10000>,
> 3, 1, 1, 32> >&, 0>, Derived = Eigen::Matrix<float, 10000, 3, 0, 10000,
> 3>]’
> /home/benjamin/env/include/eigen2/Eigen/src/Core/Assign.h:420:
> instantiated from ‘static Derived& Eigen::ei_assign_selector<Derived,
> OtherDerived, false, false>::run(Derived&, const OtherDerived&) [with
> Derived = Eigen::Matrix<float, 10000, 3, 0, 10000, 3>, OtherDerived =
> Eigen::Product<const Eigen::Map<Eigen::Matrix<float, 10000, 1, 0, 10000, 1>,
> 1>&, const Eigen::Transpose<Eigen::Block<Eigen::Matrix<double, 3, 10000, 0,
> 3, 10000>, 3, 1, 1, 32> >&, 0>]’
> /home/benjamin/env/include/eigen2/Eigen/src/Core/Matrix.h:337:
> instantiated from ‘Eigen::Matrix<_Scalar, _Rows, _Cols, _StorageOrder,
> _MaxRows, _MaxCols>::Matrix(const Eigen::MatrixBase<OtherDerived>&) [with
> OtherDerived = Eigen::Product<const Eigen::Map<Eigen::Matrix<float, 10000,
> 1, 0, 10000, 1>, 1>&, const
> Eigen::Transpose<Eigen::Block<Eigen::Matrix<double, 3, 10000, 0, 3, 10000>,
> 3, 1, 1, 32> >&, 0>, _Scalar = float, int _Rows = 10000, int _Cols = 3, int
> _StorageOrder = 0, int _MaxRows = 10000, int _MaxCols = 3]’
> /home/benjamin/env/include/eigen2/Eigen/src/Core/CwiseBinaryOp.h:90:
> instantiated from ‘Eigen::CwiseBinaryOp<BinaryOp, Lhs,
> Rhs>::CwiseBinaryOp(const Lhs&, const Rhs&, const BinaryOp&) [with BinaryOp
> = Eigen::ei_scalar_sum_op<float>, Lhs = Eigen::Matrix<float, 10000, 10000,
> 0, 10000, 10000>, Rhs = Eigen::Product<const Eigen::Map<Eigen::Matrix<float,
> 10000, 1, 0, 10000, 1>, 1>&, const
> Eigen::Transpose<Eigen::Block<Eigen::Matrix<double, 3, 10000, 0, 3,
> 10000>,3, 1, 1, 32> >&, 0>]’
> /home/benjamin/env/include/eigen2/Eigen/src/Core/CwiseBinaryOp.h:167:
> instantiated from ‘const
> Eigen::CwiseBinaryOp<Eigen::ei_scalar_sum_op<typename
> Eigen::ei_traits<T>::Scalar>, Derived, OtherDerived>
> Eigen::MatrixBase<Derived>::operator+(const
> Eigen::MatrixBase<OtherDerived>&) const [with OtherDerived =
> Eigen::Product<const Eigen::Map<Eigen::Matrix<float, 10000, 1, 0, 10000, 1>,
> 1>&, const Eigen::Transpose<Eigen::Block<Eigen::Matrix<double, 3, 10000, 0,
> 3,10000>, 3, 1, 1, 32> >&, 0>, Derived = Eigen::Matrix<float, 10000, 10000,
> 0, 10000, 10000>]’
> /home/benjamin/env/include/eigen2/Eigen/src/Core/CwiseBinaryOp.h:179:
> instantiated from ‘Derived& Eigen::MatrixBase<Derived>::operator+=(const
> Eigen::MatrixBase<OtherDerived>&) [with OtherDerived = Eigen::Product<const
> Eigen::Map<Eigen::Matrix<float, 10000, 1, 0, 10000, 1>, 1>&, const
> Eigen::Transpose<Eigen::Block<Eigen::Matrix<double, 3, 10000, 0, 3, 10000>,
> 3, 1, 1, 32> >&, 0>, Derived = Eigen::Matrix<float, 10000, 10000, 0, 10000,
> 10000>]’
> /home/benjamin/env/include/eigen2/Eigen/src/Core/Matrix.h:243:
> instantiated from ‘Eigen::Matrix<_Scalar, _Rows, _Cols, _StorageOrder,
> _MaxRows, _MaxCols>& Eigen::Matrix<_Scalar, _Rows, _Cols, _StorageOrder,
> _MaxRows, _MaxCols>::operator+=(const Eigen::MatrixBase<OtherDerived>&)
> [with OtherDerived = Eigen::Product<const Eigen::Map<Eigen::Matrix<float,
> 10000, 1, 0, 10000, 1>, 1>&, const
> Eigen::Transpose<Eigen::Block<Eigen::Matrix<double, 3, 10000, 0, 3, 10000>,
> 3, 1, 1, 32> >&, 0>, _Scalar = float, int _Rows = 10000, int _Cols = 10000,
> int _StorageOrder = 0, int _MaxRows = 10000, int _MaxCols = 10000]’
> /home/benjamin/eth/masterarbeit/viewer/libsph/SPHSampler.cpp:224:
> instantiated from here
> /home/benjamin/env/include/eigen2/Eigen/src/Core/Product.h:465: error: no
> matching function for call to ‘ei_pmul(float __vector__, double
> __vector__)’
> make[2]: *** [libsph/CMakeFiles/sph.dir/SPHSampler.cpp.o] Error 1
> make[2]: *** Waiting for unfinished jobs....
> make[2]: Leaving directory `/home/benjamin/software/build/viewer-build'
> make[1]: *** [libsph/CMakeFiles/sph.dir/all] Error 2
> make[1]: Leaving directory `/home/benjamin/software/build/viewer-build'
> make: *** [all] Error 2
>
>
>

---


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