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

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


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,
Peter
                                                         ^


In file included from /home/peter/Eigen/eigen/Eigen/Core:326:0,
                 from /home/peter/Eigen/eigen/Eigen/Dense:1,
                 from Test.C:7:
/home/peter/Eigen/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h: In instantiation of ‘void Eigen::internal::gebp_kernel<LhsScalar, RhsScalar, Index, mr, nr, ConjugateLhs, ConjugateRhs>::operator()(Eigen::internal::gebp_kernel<LhsScalar, RhsScalar, Index, mr, nr, ConjugateLhs, ConjugateRhs>::ResScalar*, Index, const LhsScalar*, const RhsScalar*, Index, Index, Index, Eigen::internal::gebp_kernel<LhsScalar, RhsScalar, Index, mr, nr, ConjugateLhs, ConjugateRhs>::ResScalar, Index, Index, Index, Index, RhsScalar*) [with LhsScalar = MyType<std::complex<double> >; RhsScalar = MyType<std::complex<double> >; Index = long int; int mr = 2; int nr = 4; bool ConjugateLhs = true; bool ConjugateRhs = false; Eigen::internal::gebp_kernel<LhsScalar, RhsScalar, Index, mr, nr, ConjugateLhs, ConjugateRhs>::ResScalar = MyType<std::complex<double> >]’:
/home/peter/Eigen/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h:187:104:   required from ‘static void Eigen::internal::general_matrix_matrix_product<Index, LhsScalar, LhsStorageOrder, ConjugateLhs, RhsScalar, RhsStorageOrder, ConjugateRhs, 0>::run(Index, Index, Index, const LhsScalar*, Index, const RhsScalar*, Index, Eigen::internal::general_matrix_matrix_product<Index, LhsScalar, LhsStorageOrder, ConjugateLhs, RhsScalar, RhsStorageOrder, ConjugateRhs, 0>::ResScalar*, Index, Eigen::internal::general_matrix_matrix_product<Index, LhsScalar, LhsStorageOrder, ConjugateLhs, RhsScalar, RhsStorageOrder, ConjugateRhs, 0>::ResScalar, Eigen::internal::level3_blocking<LhsScalar, RhsScalar>&, Eigen::internal::GemmParallelInfo<Index>*) [with Index = long int; LhsScalar = MyType<std::complex<double> >; int LhsStorageOrder = 1; bool ConjugateLhs = true; RhsScalar = MyType<std::complex<double> >; int RhsStorageOrder = 0; bool ConjugateRhs = false; Eigen::internal::general_matrix_matrix_product<Index, LhsScalar, LhsStorageOrder, ConjugateLhs, RhsScalar, RhsStorageOrder, ConjugateRhs, 0>::ResScalar = MyType<std::complex<double> >]’
/home/peter/Eigen/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h:41:88:   required from ‘static void Eigen::internal::general_matrix_matrix_product<Index, LhsScalar, LhsStorageOrder, ConjugateLhs, RhsScalar, RhsStorageOrder, ConjugateRhs, 1>::run(Index, Index, Index, const LhsScalar*, Index, const RhsScalar*, Index, Eigen::internal::general_matrix_matrix_product<Index, LhsScalar, LhsStorageOrder, ConjugateLhs, RhsScalar, RhsStorageOrder, ConjugateRhs, 1>::ResScalar*, Index, Eigen::internal::general_matrix_matrix_product<Index, LhsScalar, LhsStorageOrder, ConjugateLhs, RhsScalar, RhsStorageOrder, ConjugateRhs, 1>::ResScalar, Eigen::internal::level3_blocking<RhsScalar, LhsScalar>&, Eigen::internal::GemmParallelInfo<Index>*) [with Index = long int; LhsScalar = MyType<std::complex<double> >; int LhsStorageOrder = 1; bool ConjugateLhs = false; RhsScalar = MyType<std::complex<double> >; int RhsStorageOrder = 0; bool ConjugateRhs = true; Eigen::internal::general_matrix_matrix_product<Index, LhsScalar, LhsStorageOrder, ConjugateLhs, RhsScalar, RhsStorageOrder, ConjugateRhs, 1>::ResScalar = MyType<std::complex<double> >]’
/home/peter/Eigen/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h:227:46:   required from ‘void Eigen::internal::gemm_functor<Scalar, Index, Gemm, Lhs, Rhs, Dest, BlockingType>::operator()(Index, Index, Index, Index, Eigen::internal::GemmParallelInfo<Index>*) const [with Scalar = MyType<std::complex<double> >; Index = long int; Gemm = Eigen::internal::general_matrix_matrix_product<long int, MyType<std::complex<double> >, 1, false, MyType<std::complex<double> >, 0, true, 1>; Lhs = Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1>; Rhs = Eigen::Transpose<const Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1> >; Dest = Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1>; BlockingType = Eigen::internal::gemm_blocking_space<1, MyType<std::complex<double> >, MyType<std::complex<double> >, -1, -1, -1, 1, false>]’
/home/peter/Eigen/eigen/Eigen/src/Core/products/Parallelizer.h:96:22:   required from ‘void Eigen::internal::parallelize_gemm(const Functor&, Index, Index, bool) [with bool Condition = true; Functor = Eigen::internal::gemm_functor<MyType<std::complex<double> >, long int, Eigen::internal::general_matrix_matrix_product<long int, MyType<std::complex<double> >, 1, false, MyType<std::complex<double> >, 0, true, 1>, Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1>, Eigen::Transpose<const Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1> >, Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1>, Eigen::internal::gemm_blocking_space<1, MyType<std::complex<double> >, MyType<std::complex<double> >, -1, -1, -1, 1, false> >; Index = long int]’
/home/peter/Eigen/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h:427:208:   required from ‘void Eigen::GeneralProduct<Lhs, Rhs, 5>::scaleAndAddTo(Dest&, const Scalar&) const [with Dest = Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1>; Lhs = Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1>; Rhs = Eigen::CwiseUnaryOp<Eigen::internal::scalar_conjugate_op<MyType<std::complex<double> > >, const Eigen::Transpose<const Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1> > >; Eigen::GeneralProduct<Lhs, Rhs, 5>::Scalar = MyType<std::complex<double> >]’
/home/peter/Eigen/eigen/Eigen/src/Core/ProductBase.h:118:71:   [ skipping 2 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/home/peter/Eigen/eigen/Eigen/src/Core/ProductBase.h:284:3:   required from ‘Derived& Eigen::MatrixBase<Derived>::lazyAssign(const Eigen::ProductBase<ProductDerived, Lhs, Rhs>&) [with ProductDerived = Eigen::GeneralProduct<Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1>, Eigen::CwiseUnaryOp<Eigen::internal::scalar_conjugate_op<MyType<std::complex<double> > >, const Eigen::Transpose<const Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1> > >, 5>; Lhs = Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1>; Rhs = Eigen::CwiseUnaryOp<Eigen::internal::scalar_conjugate_op<MyType<std::complex<double> > >, const Eigen::Transpose<const Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1> > >; Derived = Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1>]’
/home/peter/Eigen/eigen/Eigen/src/Core/PlainObjectBase.h:414:46:   required from ‘Derived& Eigen::PlainObjectBase<Derived>::lazyAssign(const Eigen::DenseBase<OtherDerived>&) [with OtherDerived = Eigen::GeneralProduct<Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1>, Eigen::CwiseUnaryOp<Eigen::internal::scalar_conjugate_op<MyType<std::complex<double> > >, const Eigen::Transpose<const Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1> > >, 5>; Derived = Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1>]’
/home/peter/Eigen/eigen/Eigen/src/Core/Assign.h:527:123:   required from ‘static Derived& Eigen::internal::assign_selector<Derived, OtherDerived, false, false>::run(Derived&, const OtherDerived&) [with Derived = Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1>; OtherDerived = Eigen::GeneralProduct<Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1>, Eigen::CwiseUnaryOp<Eigen::internal::scalar_conjugate_op<MyType<std::complex<double> > >, const Eigen::Transpose<const Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1> > >, 5>]’
/home/peter/Eigen/eigen/Eigen/src/Core/PlainObjectBase.h:653:105:   required from ‘Derived& Eigen::PlainObjectBase<Derived>::_set_noalias(const Eigen::DenseBase<OtherDerived>&) [with OtherDerived = Eigen::GeneralProduct<Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1>, Eigen::CwiseUnaryOp<Eigen::internal::scalar_conjugate_op<MyType<std::complex<double> > >, const Eigen::Transpose<const Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1> > >, 5>; Derived = Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1>]’
/home/peter/Eigen/eigen/Eigen/src/Core/Matrix.h:296:31:   required from ‘Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::Matrix(const Eigen::MatrixBase<OtherDerived>&) [with OtherDerived = Eigen::GeneralProduct<Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1>, Eigen::CwiseUnaryOp<Eigen::internal::scalar_conjugate_op<MyType<std::complex<double> > >, const Eigen::Transpose<const Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1> > >, 5>; _Scalar = MyType<std::complex<double> >; int _Rows = -1; int _Cols = -1; int _Options = 1; int _MaxRows = -1; int _MaxCols = -1]’
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;
                                                                ^
In file included from Test.C:7:
In file included from /home/peter/Eigen/eigen/Eigen/Dense:1:
In file included from /home/peter/Eigen/eigen/Eigen/Core:326:
/home/peter/Eigen/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h:545:64: error: implicit instantiation of undefined template 'Eigen::internal::conj_helper<MyType<std::complex<double> >, MyType<std::complex<double> >, true, false>'
    conj_helper<LhsScalar,RhsScalar,ConjugateLhs,ConjugateRhs> cj;
                                                               ^
/home/peter/Eigen/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h:187:9: note: in instantiation of member function 'Eigen::internal::gebp_kernel<MyType<std::complex<double> >, MyType<std::complex<double> >, long, 2, 4, true, false>::operator()' requested here
        gebp(res+i2, resStride, blockA, blockB, actual_mc, actual_kc, cols, alpha, -1, -1, 0, 0, blockW);
        ^
/home/peter/Eigen/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h:41:7: note: in instantiation of member function 'Eigen::internal::general_matrix_matrix_product<long, MyType<std::complex<double> >, 1, true, MyType<std::complex<double> >, 0, false, 0>::run' requested here
    ::run(cols,rows,depth,rhs,rhsStride,lhs,lhsStride,res,resStride,alpha,blocking,info);
      ^
/home/peter/Eigen/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h:223:11: note: in instantiation of member function 'Eigen::internal::general_matrix_matrix_product<long, MyType<std::complex<double> >, 1, false, MyType<std::complex<double> >, 0, true, 1>::run' requested here
    Gemm::run(rows, cols, m_lhs.cols(),
          ^
/home/peter/Eigen/eigen/Eigen/src/Core/products/Parallelizer.h:96:3: note: in instantiation of member function 'Eigen::internal::gemm_functor<MyType<std::complex<double> >, long, Eigen::internal::general_matrix_matrix_product<long, MyType<std::complex<double> >, 1, false, MyType<std::complex<double> >, 0, true, 1>, Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1, -1, -1>, Eigen::Transpose<const Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1, -1, -1> >, Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1, -1, -1>, Eigen::internal::gemm_blocking_space<1, MyType<std::complex<double> >, MyType<std::complex<double> >, -1, -1, -1, 1, false> >::operator()' requested here
  func(0,rows, 0,cols);
  ^
/home/peter/Eigen/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h:427:17: note: in instantiation of function template specialization 'Eigen::internal::parallelize_gemm<true, Eigen::internal::gemm_functor<MyType<std::complex<double> >, long, Eigen::internal::general_matrix_matrix_product<long, MyType<std::complex<double> >, 1, false, MyType<std::complex<double> >, 0, true, 1>, Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1, -1, -1>, Eigen::Transpose<const Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1, -1, -1> >, Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1, -1, -1>, Eigen::internal::gemm_blocking_space<1, MyType<std::complex<double> >, MyType<std::complex<double> >, -1, -1, -1, 1, false> >, long>' requested here
      internal::parallelize_gemm<(Dest::MaxRowsAtCompileTime>32 || Dest::MaxRowsAtCompileTime==Dynamic)>(GemmFunctor(lhs, rhs, dst, actualAlpha, blocking), this->rows(), this->cols(), Dest::Flags&RowMajorBit);
                ^
/home/peter/Eigen/eigen/Eigen/src/Core/ProductBase.h:118:81: note: (skipping 3 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all)
    inline void scaleAndAddTo(Dest& dst, const Scalar& alpha) const { derived().scaleAndAddTo(dst,alpha); }
                                                                                ^
/home/peter/Eigen/eigen/Eigen/src/Core/PlainObjectBase.h:414:20: note: in instantiation of function template specialization 'Eigen::MatrixBase<Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1, -1, -1> >::lazyAssign<Eigen::GeneralProduct<Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1, -1, -1>, Eigen::CwiseUnaryOp<Eigen::internal::scalar_conjugate_op<MyType<std::complex<double> > >, const Eigen::Transpose<const Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1, -1, -1> > >, 5>, Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1, -1, -1>, Eigen::CwiseUnaryOp<Eigen::internal::scalar_conjugate_op<MyType<std::complex<double> > >, const Eigen::Transpose<const Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1, -1, -1> > > >' requested here
      return Base::lazyAssign(other.derived());
                   ^
/home/peter/Eigen/eigen/Eigen/src/Core/Assign.h:527:97: note: in instantiation of function template specialization 'Eigen::PlainObjectBase<Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1, -1, -1> >::lazyAssign<Eigen::GeneralProduct<Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1, -1, -1>, Eigen::CwiseUnaryOp<Eigen::internal::scalar_conjugate_op<MyType<std::complex<double> > >, const Eigen::Transpose<const Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1, -1, -1> > >, 5> >' requested here
  static EIGEN_STRONG_INLINE Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.derived()); }
                                                                                                ^
/home/peter/Eigen/eigen/Eigen/src/Core/PlainObjectBase.h:653:69: note: in instantiation of member function 'Eigen::internal::assign_selector<Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1, -1, -1>, Eigen::GeneralProduct<Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1, -1, -1>, Eigen::CwiseUnaryOp<Eigen::internal::scalar_conjugate_op<MyType<std::complex<double> > >, const Eigen::Transpose<const Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1, -1, -1> > >, 5>, false, false>::run' requested here
      return internal::assign_selector<Derived,OtherDerived,false>::run(this->derived(), other.derived());
                                                                    ^
/home/peter/Eigen/eigen/Eigen/src/Core/Matrix.h:296:13: note: in instantiation of function template specialization 'Eigen::PlainObjectBase<Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1, -1, -1> >::_set_noalias<Eigen::GeneralProduct<Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1, -1, -1>, Eigen::CwiseUnaryOp<Eigen::internal::scalar_conjugate_op<MyType<std::complex<double> > >, const Eigen::Transpose<const Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1, -1, -1> > >, 5> >' requested here
      Base::_set_noalias(other);
            ^
Test.C:111:19: note: in instantiation of function template specialization 'Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1, -1, -1>::Matrix<Eigen::GeneralProduct<Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1, -1, -1>, Eigen::CwiseUnaryOp<Eigen::internal::scalar_conjugate_op<MyType<std::complex<double> > >, const Eigen::Transpose<const Eigen::Matrix<MyType<std::complex<double> >, -1, -1, 1, -1, -1> > >, 5> >' requested here
        TpMatrix rho3 =  H * H.adjoint(); // not o.k.
                         ^
/home/peter/Eigen/eigen/Eigen/src/Core/util/ForwardDeclarations.h:151:97: note: template is declared here
template<typename LhsScalar, typename RhsScalar, bool ConjLhs=false, bool ConjRhs=false> struct conj_helper;
                                                                                                ^
1 error generated.
#include <stdlib.h>

#include <cmath>

#include <complex>

#include <Eigen/Dense>

#include <boost/utility/enable_if.hpp> //needed for enable_if
#include <boost/type_traits/is_complex.hpp>

// g++  -std=c++11 -DNDEBUG -g Test.C   -I $HOME/Eigen/eigen  -o Test  2>&1 | tee Err.txt | more


template<typename T>
class MyType
{
  public:

    typedef T value_type;
	
    MyType( const T a, const T b ) : za(a), zb(b) {};
    MyType( const MyType& a) : za(a.za), zb(a.zb) {};
    MyType( const T& z) : za(z), zb(0) {};
    MyType( const int z) : za(z), zb(0) {}; //needed for eigen
    MyType() {};

    const T& z1() const { return za; };
    T& z1() { return za; };

    const T& z2() const { return zb; };
    T& z2() { return zb; };

    MyType& operator+=(const T a)      { za += a; return *this; }
    MyType& operator+=(const MyType a) { za += a.za; zb += a.zb; return *this; }

protected:
    T za, zb;
};


typedef   double TpFloatBase;
typedef   std::complex<TpFloatBase> TpComplex;

typedef   MyType < TpFloatBase > TpRFloat;
typedef   MyType < TpComplex   > TpFloat;


///=====================================================
/// Eigen typedefs
///=====================================================


typedef Eigen::Matrix< TpFloat,   Eigen::Dynamic, 1> TpVector;
typedef Eigen::Matrix< TpFloat,   Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> TpMatrix;

typedef Eigen::Array< TpFloat  , Eigen::Dynamic, 1>  TpArray;

template<class Q> 
typename boost::enable_if< boost::is_complex<Q>, MyType<Q> >::type conj( const MyType< Q >& a) { return MyType<Q>( conj( a.z1() ), conj( a.z2() ));  };

template<class T> MyType<T> operator+(const  T a , const MyType<T> b)           { return MyType<T>( a + b.z1() , b.z2() );}
template<class T> MyType<T> operator+(const  MyType<T> a , const T b)           { return MyType<T>( a.z1() + b , a.z2() );}
template<class T> MyType<T> operator+(const  MyType<T> a , const MyType<T> b)   { return MyType<T>( a.z1() + b.z1() , a.z2() + b.z2() );}

template<class T> MyType<T> operator-(const  T a , const MyType<T> b)           { return MyType<T>( a - b.z1() , - b.z2() );}
template<class T> MyType<T> operator-(const  MyType<T> a ,const  T b)           { return MyType<T>( a.z1() - b , - a.z2() );}
template<class T> MyType<T> operator-(const  MyType<T> a ,const  MyType<T> b)   { return MyType<T>( a.z1() - b.z1() , a.z2() - b.z2() );}

template<class T> MyType<T> operator*( const T a , const MyType<T> b)           { return MyType<T>( a * b.z1() , a*b.z2() ); }
template<class T> MyType<T> operator*( const MyType<T> a , const  T b)          { return MyType<T>( a.z1() * b , a.z2()*b ); }
template<class T> MyType<T> operator*( const MyType<T> a , const MyType<T> b)   { return MyType<T>( a.z1() * b.z1() , a.z1()*b.z1() ) ; }

///=====================================================
/// Needed for Eigen IO
///=====================================================

namespace Eigen 
{

	template<> struct NumTraits<TpFloat> : NumTraits<TpComplex> // permits to get the epsilon, dummy_precision, lowest, highest functions
	{
			typedef TpRFloat Real;

			static inline Real epsilon()         { return TpRFloat( NumTraits<TpFloatBase>::epsilon()          ); }
			static inline Real dummy_precision() { return TpRFloat( NumTraits<TpFloatBase>::dummy_precision()  ); }
	};

	namespace internal 
	{
		template<> struct significant_decimals_impl<TpFloat> : public significant_decimals_impl<TpFloatBase>
		{ 
		};
	}

}


int main( const int argc, const char *argv[] )
{
	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.
	
	return 0;
}


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