Re: [eigen] problem with operator() in development branch

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



ok, the pb is that's quite dangerous to offer coeff-based access because we want to make sure that such a product _expression_ is never used by any coefficient based algorithm. Of course, in the above example, there is only one access, so it is fine, but think about a user code doing a manual loop on a general DenseMatrix...

On the other hand, ProductBase has to inherit DenseMatrix to make it compatible with all high level operation as in A*B+C...

To be honest I don't see any use case for doing coeff based accesses on a product _expression_.

Perhaps I can try to make the compilation error more explicit using a static assertion.

gael


On Fri, May 28, 2010 at 7:16 AM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:
ok, i seem to remember that there was a serious reason why we couldn't
allow it, but it escapes me. Can you please remind me?

Benoit

2010/5/26 Benoit Jacob <jacob.benoit.1@xxxxxxxxx>:
> oh, I know about this issue.
>
> Gael: the issue is that ProductBase doesn't allow coeff-based access.
> But it inherits DenseBase. Honestly I think that it would be far
> simpler if we said that by convention, and xpr inheriting DenseBase
> has (usable) coeff methods. Is that OK? Do you see a big difficulty
> with allowing that? If you think that's really not possible, then do
> you agree that ProductBase should not inherit DenseBase anymore?
>
> Benoit
>
> 2010/5/26 Bill Greene <w.h.greene@xxxxxxxxx>:
>> I'm running with a very recent version of Eigen from the development branch.
>> The following code snippet works fine with Eigen 2
>>
>>  Eigen::MatrixXd a(1,2), b(2,1);
>>  a << 1, 2;
>>  b << 2, 3;
>>  double c = (a*b)(0,0);
>>  std::cout << "c=" << c << std::endl;
>>
>> but I get a compilation error with VC++ 2008 and the development branch Eigen
>>
>> d:\u_drive\src\eigen\dev_branch\eigen\eigen\src\core\densecoeffsbase.h(92)
>> : error C2248: 'Eigen::ProductBase<Derived,Lhs,Rhs>::coeff' : cannot
>> access private member declared in class
>> 'Eigen::ProductBase<Derived,Lhs,Rhs>'
>> 1>
>>
>> Thanks.
>>
>> Bill Greene
>>
>>
>>
>



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