Re: [eigen] TriangularViewType& operator/=(const typename internal::traits<MatrixType>::Scalar& other) |
[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]
Dear All,
I'm trying to extend my simple test code using eigen for a user defined type
including the diagonalization. Sadly, I got lost in the template machinery.
In short
template<typename T>
class MyType
{
public:
typedef T value_type;
// ...
protected:
T za, zb;
};
typedef double TpFloatBase;
typedef std::complex<TpFloatBase> TpComplex;
typedef MyType < TpFloatBase > TpRFloat;
typedef MyType < TpComplex > TpFloat;
Eigen::SelfAdjointEigenSolver<TpMatrix> eigensolverH;
eigensolverH.compute(H);
triggers
/home/peter/Eigen/eigen/Eigen/src/Core/TriangularMatrix.h:38 6:26: note: Eigen::TriangularViewImpl<_Mat rixType, _Mode, Eigen::Dense>::TriangularViewT ype& Eigen::TriangularViewImpl<_Mat rixType, _Mode, Eigen::Dense>::operator/=(cons t typename Eigen::internal::traits<T>::Sc alar&) [with _MatrixType = Eigen::Matrix<MyType<std::comp lex<double> >, -1, -1, 0, -1, -1>; unsigned int _Mode = 1u; Eigen::TriangularViewImpl<_Mat rixType, _Mode, Eigen::Dense>::TriangularViewT ype = Eigen::TriangularView<Eigen::M atrix<MyType<std::complex<doub le> >, -1, -1, 0, -1, -1>, 1u>; typename Eigen::internal::traits<T>::Sc alar = MyType<std::complex<double> >]
TriangularViewType& operator/=(const typename internal::traits<MatrixType>::Scalar& other) { return *this = derived().nestedExpression() / other; }
^
/home/peter/Eigen/eigen/Eigen/src/Core/TriangularMatrix.h:38 6:26: note: no known conversion for argument 1 from ‘Eigen::SelfAdjointEigenSolver <Eigen::Matrix<MyType<std:: complex<double> >, -1, -1, 1> >::RealScalar {aka MyType<double>}’ to ‘const Scalar& {aka const MyType<std::complex<double> >&}’
I thought it would be sufficient to define
template<class T>
MyType< std::complex<T> > operator/( const MyType< std::complex<T> >& z , const MyType<T>& b)
{
return z / MyType< std::complex<T > >( b.z1() , b.z2() ); ///< Could be optimized
}
And indeed
TpRFloat r(1);
TpFloat z(2);
TpFloat q = z / r; // o.k.
compiles fine.
Could you please give be hint, which operator I'm missing?
I've attached the complete source file that triggers the error, including the error messages I get using
"g++ -std=c++11 -g Test.C -I $HOME/Eigen/eigen -o Test " .
Note, that some the operator definition doesn't make sense mathematically, I just put something to get it compiled.
Thanks in advance,
best regards,
Peter
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |