Re: [eigen] problem with selfadjointView |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] problem with selfadjointView
- From: Ben Goodrich <bgokgm@xxxxxxxxxxxxxx>
- Date: Sun, 22 Aug 2010 12:00:30 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=D+tT8F1zYqp1p3lytPQrLtxyVrs8wHWyCR6FGlUOz0I=; b=oPAWkWpEWsO5eFI9iMro5R9XmcmziD2H+soMU9Hz4upSMc/cSs9m5dza/6ah6ExOc7 PCZdIBN1aET+xQNE3fu4c5AycqcRl2xTEe0BAL1yHeSOdQDhd9StkHVNHQP6z8H6Aqy5 hDxRuiBYVBub3/3Qn6jwGA3olevzwSlU/xQD4=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=ZbjZN8CaXK04DpGnlhB1yrYwAFBcZFl4EbPhE+3ntxR6uCGglw9eBZxy17JICDvoF3 0PeOuhK3C6bwqcvLeZmcATFEsrX2SpE4WViyhG6YCUL+FoTHbOmyn4j9ZPfDh3srCuMP mesVz64D9c7/LqYy2bkRPS9OCzeai3eHuxpV0=
On Sun, Aug 22, 2010 at 11:28 AM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:
>
>
> 2010/8/22 Ben Goodrich <bgokgm@xxxxxxxxxxxxxx>
>>
>> On Sun, Aug 22, 2010 at 7:39 AM, Jitse Niesen <jitse@xxxxxxxxxxxxxxxxx>
>> wrote:
>> > On Sat, 21 Aug 2010, Ben Goodrich wrote:
>> >
>> >> Thanks for implementing that. Is there something special needed to
>> >> make it work with templates? I would have expected
>> >>
>> >> template <typename Derived>
>> >> void bar(const MatrixBase<Derived> &x, const MatrixBase<Derived> &A,
>> >> MatrixBase<Derived> &z) {
>> >> z = x.transpose() * A.selfadjointView<Lower>() * x;
>> >> }
>> >>
>> >> to work now, but the compiler throws an expected primary-expression
>> >> error.
>> >
>> > Perhaps you need to add the 'template' keyword, as in:
>> >
>> > z = x.transpose() * A.template selfadjointView<Lower>() * x;
>> >
>> > Warning: I did not try it out.
>> >
>> >
>> > Jitse
>>
>> I had tried that yesterday but forgot to mention it. It doesn't work
>> for me, but maybe the .template() trick should be mentioned somewhere
>> in the documentation?
>
> I confirm what Jitse says, but since it's a general C++ syntax quirk, it's
> hard for us to document it everywhere where needed.
>
> Can you paste the whole compiler error that you're getting?
>
> Benoit
Aha! What Jitse says does, in fact, work for me. I was incorrectly
using template() and g++ was telling me
benchmark.cc:6: error: expected primary-expression before ‘)’ token
which was the same cryptic compiler error that it was giving me when I
was just doing
z = x.transpose() * A.selfadjointView<Lower>() * x;
so I incorrectly assumed that it wasn't making any difference.
Thanks,
Ben