Re: [eigen] Re: XLC Port: Part II - External definition of a template member function of a template class causing the problems?

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


Dear All,

Thanks Thomas for your input.  I went back and double-checked the class/typename declarations/definitions and nothing obvious appeared.

This does not appear to be a typename/class bug.  In the classes that I have looked at so far, the Eigen developers have been fairly careful to use the 'typename' keyword almost exclusively.  Is it possible that the XLC Compiler does not know how to deduce the template arguments for ei_traits when it is used like so?

template<typename MatrixType, int BlockRows=Dynamic, int BlockCols=Dynamic,
  int _DirectAccessStatus = (ei_traits<MatrixType>::Flags&DirectAccessBit) ? HasDirectAccess : NoDirectAccess> class Block;

In Eigen ei_traits is not defined as a single template parameter template.  It is forward declared:

template<typename C> struct ei_traits; 

It is defined in Matrix.h like this:

template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
struct ei_traits<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
{ ... }

It is defined later in ArrayWrapper.h like this:
template<typename ExpressionType>
struct ei_traits<MatrixWrapper<ExpressionType> >
 : public ei_traits<ExpressionType>

But I suspect the intended usage is in Matrix.h, not in ArrayWrapper.h (I don't think XLC is attempting to use either definition, but I'm puzzled as to why it doesn't like even the ArrayWrapper template).

I understand that there's a concept of adding 'traits' by using templates, but I don't know much beyond that or how to understand whether or not Eigen is doing something valid here.  By using the inlining described before, I can successfully at least include all of Core without getting any compiler errors, it is now in the instantiation phase that XLC is whining.  More thoughts and advice are always appreciated.

Aron



On Wed, Jan 27, 2010 at 5:54 PM, Alexandre Eichenberger <alexe@xxxxxxxxxx> wrote:

Aron,

I have contacted someone at Toronto (product division) but have not heard back from them. Please keep me updated on whether the fix proposed by Thomas worked for you with xlc.


Alexandre

------------------------------------------------------------------------------------------
Alexandre Eichenberger, Advanced Compiler Technologies
- research: compiler optimization & SIMD code generation
- mail/info: http://www.research.ibm.com/people/a/alexe
- phone: 862-1812 (t/l), 914-945-1812 (external)


Inactive hide details for Thomas Capricelli ---01/27/2010 09:18:27 AM---Ah, wait, i've had this kind of problem when trying iccThomas Capricelli ---01/27/2010 09:18:27 AM---Ah, wait, i've had this kind of problem when trying icc (i think) : there are templates declared (in


From:

Thomas Capricelli <orzel@xxxxxxxxxxxxxxx>

To:

eigen@xxxxxxxxxxxxxxxxxxx

Cc:

Aron Ahmadia <aja2111@xxxxxxxxxxxx>, Alexandre Eichenberger/Watson/IBM@IBMUS, John A Gunnels/Watson/IBM@IBMUS, aron.ahmadia@xxxxxxxxxxxx

Date:

01/27/10 09:18 AM

Subject:

Re: [eigen] Re: XLC Port: Part II - External definition of a template member function of a template class causing the problems?






Ah, wait, i've had this kind of problem when trying icc (i think) : there are templates declared (in forward as
template<typename T>

but later on defined with
template<class T>

It seems that most compilers do not care. I think icc issued warnings.. maybe yours is just not happy with this. This can easily be fixed without disturbing other compilers i think.

Thomas
--
Thomas Capricelli <orzel@xxxxxxxxxxxxxxx>
http://www.freehackers.org/thomas

In data mercoledì 27 gennaio 2010 14:50:38, Thomas Capricelli ha scritto:
> > template<typename T> struct ei_traits;



GIF image

GIF image



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