Re: [eigen] Eigen "views" |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Eigen "views"
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Tue, 16 Aug 2011 08:41:50 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=2JQZG4QP+MfkPNxUbdQKNRBwQymhoenF48DecRWrVcI=; b=rNnZtv36YeiY/ha5+bHMtImMUJBhC+WDCvA6SFOswVMde5Guf6k6C2FJxHTsTwFnXW 1qf2/N6bdrWEu7ZdoF6TK22VNCDYE9mxtU4a1tynAi1uMzDuCmJCZtBkefNzuGO8fdTl IAQZMi90f2tGbyu36N5XGcytqjaqRLMIoSEhU=
there are some major differences though:
With PermutationMatrix you can do transposed products.
With such views you can repeat a row (or column) multiple times,
remove some, etc.
The conclusion is that though there is a non null intersection none of
them is a subset of the other one.
gael
On Mon, Aug 15, 2011 at 9:49 PM, Jim Bosch <talljimbo@xxxxxxxxx> wrote:
> On 08/15/2011 12:24 PM, Benoit Jacob wrote:
>>
>> (Disclaimer: I've been away for a while so I might not be up to date.
>> If Gael contradicts me, listen to him)
>>
>> This has been asked for many times, and I think there was consensus
>> that this would be a welcome addition. It also isn't hard to
>> implement. It's just that nobody has actually done the work yet :)
>>
>> If you want to do it yourself, the right Eigen way to do it is to add
>> a new expression class, holding references to the original vector and
>> to the integer vector of indices. For a simple expression class to
>> start from as an example, look at the Minor class in Eigen2Support,
>> it's as easy as it gets. The core part of the implementation would be
>> the coeff() accessor methods in this class, and they would look like:
>>
>> CoeffReturnType MyViewExpression::coeff(Index i)
>> {
>> return m_originalVector.coeff(m_indicesVector.coeff(i));
>> }
>>
>
> I'd like to suggest that the "right way" might also include some
> interoperability with the PermutationMatrix class. I could see that getting
> a lot more complicated, of course, when it comes to permuting the rows or
> columns of a matrix, but it's essentially just a different syntax for the
> same operation.
>
> Thanks!
>
> Jim Bosch
>
>
>