Re: [eigen] Eigen::internal::conj_helper: cj has incomplete type

[ Thread Index | Date Index | More Archives ]

Thank you for the report. I've a local fix that I'll push as soon as the unit tests finish to compile....

It boils down to adding the following in namespace internal:

// Generic implementation for custom complex types.
template<typename LhsScalar, typename RhsScalar, bool ConjLhs, bool ConjRhs>
struct conj_helper
  typedef typename ScalarBinaryOpTraits<LhsScalar,RhsScalar>::ReturnType Scalar;

  EIGEN_STRONG_INLINE Scalar pmadd(const LhsScalar& x, const RhsScalar& y, const Scalar& c) const
  { return padd(c, pmul(x,y)); }

  EIGEN_STRONG_INLINE Scalar pmul(const LhsScalar& x, const RhsScalar& y) const
  { return conj_if<ConjLhs>()(x) *  conj_if<ConjRhs>()(y); }


On Mon, Aug 29, 2016 at 8:23 AM, Peter <list@xxxxxxxxxxxxxxxxx> wrote:
Dear All,

I've continued playing with eigen and run across the following problem, which might be related
to bug 279 and PR 194. However, it appears to me, that it is separate issue, as it is not mixing types-
Sadly, it is seems to be buried deeply into the template machinery, and my knowledge on the internals
is still pretty limited.

I wanted to used a self defined type based on complex numbers, where I can't use a matrix times its adjoint.,
in short

const int M=2;

TpMatrix H(M,M);

H << 1,2,3,4;

TpMatrix rh0  = H.adjoint();      // o.k.
TpMatrix rho1 =  H * H;           // o..k.
TpMatrix rho2 =  H + H.adjoint(); // o.k.

TpMatrix rho3 =  H * H.adjoint(); // not o.k.

The compilation for rho0, rho1, and rho2 is fine, yet rho3 gives a compilation error:

Test.C:111:33:   required from here
/home/peter/Eigen/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h:545:64: error: ‘Eigen::internal::conj_helper<MyType<std::complex<double> >, MyType<std::complex<double> >, true, false> cj’ has incomplete type
     conj_helper<LhsScalar,RhsScalar,ConjugateLhs,ConjugateRhs> cj;

I've attached a simplified version of my code, which doesn't make much sense, it's just for demonstrating the error.
In addition I've attached the error messages using g++ and clang.
I tried several recent Eigen versions, including  eigen-eigen-dc6cfdf9bcec used for the attached error messages.
They all give the same error.

Any help is appreciated,

best regards,

Mail converted by MHonArc 2.6.19+