|Re: [eigen] Passing result of block() as non-const reference-to-matrix?|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Passing result of block() as non-const reference-to-matrix?
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Fri, 9 Jul 2010 13:03:37 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.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=Up7AntM1636GLZa40/r1lB0n//b/neL3ulKTqxqYpNk=; b=blNspI612xWBr4ouoptSPGK48fAO4nGtzIAyxgDirF4zpSmoIeo0qWdZnByNenRSCx wOBLlX0MaCYc3scWJKgcCNpDpx524+hfD5Nhcl+A0htJDAHGfHTYEnqPJhfkCT5WXzy+ tG+iZ52uB8BnkxzOygTevb/bOkZQomcxZXk0w=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=KDKpHcs8hEJJ1MqTZjsqCpqGmTJJ0XqPK2lxR10bCKHiO1UxGxl0OQV59fw/1fZvFf nIoOEZHocCUJQDGaZaJr3pibeYUVgNr+H9oaApMHB9sOhiIjHkqjmi1meArbX7ExmDVC RDb169zIm8a4sh8dJecDHA2i6D9+GtlvJ8/ms=
2010/7/9 Sidney Cadot <sidney.cadot@xxxxxxxxx>:
> Hauke, Martin: thanks for your suggestions.
> It's a pity that there is no clean solution that is portable to pre-C++0x.. I still don't quite get that it does work as expected when I pass a const Block to a const Matrix & -- it is not clear for me why that /does/ work.
That does /not/ work :-) Try it, try to pass a Block as a const
Matrix&, it won't compil, since these are different types. On the
other hand, passing a Block as a template<typename T> const
MatrixBase<T>& will work, because (in the matrix case) Block inherits
MatrixBase<Block>, so the compiler will be able to resolve T=Block.
> I have a feeling that I (as an API user) need to know too much about the intricacies of the Eigen data-structures in this case, while I can usually just really on stuff to (almost magically) work; A Matrix::block() result /usually/ returns something that behaves as Matrix, but not always.
Expression templates come at the cost of some complexity, need the
user to understand some concepts. It's true. But it's worth it, so
it's a documentation issue.
Documentation ninjas: this is the reason why I believe we really need
to end the tutorial on one page explaining the vital minimum stuff to
know about base classes, passing Eigen objects to functions, etc.
> Best regards, Sidney