Re: [eigen] array slicing/range |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] array slicing/range
- From: Aron Ahmadia <aja2111@xxxxxxxxxxxx>
- Date: Fri, 5 Feb 2010 14:00:55 +0300
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to :content-type; bh=p/ZQTFe/svUYSxQMc43985TuaNNFI7zn6hyD6LvGxUY=; b=uFEonBm50Ou4p8ivkCp4x3kt50sfGX/bG0x17+UZA0F/bWsX55Kav2DaJt8ueTAtwd x4+XooVqTem4Ih2EqD/2OlpNVVzNchzSgzH+8gexm2Ebmsh6v7gK7qYCCMIdrihv6W+r VvNY2yBmYkBfC3Vkt5AjDhbXmlOW+sKcBDq6c=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; b=viddwd9iIyFb3kZjpPy99K/3AveOWxUFiN/YXds4RY6+sRlsglZk/Har+/JXEqJXDT qAe/YiElBq8eFJ55mAzEv4dAhoWvO1zU6DpuIkW+QGkHI2QZ0+ltBsJUvzT2A+6ALWCM mpIWp3pvauXFB5RbJsjaRsRevANL3TZEVfq9c=
Hi Jinglei,
> I'm wondering if it's possible to use array(i:j)
Nope. The : isn't a reserved operator in C++, so for you to use an
expression like array(i:j), the best thing you could do would be to
write your own preprocessor that automagically takes expressions of
that form and translates them to array.segment(i,j)
David Bindel (Cornell) has a piece of software that does similar (but
not what you want) preprocessing work for constant matrices:
http://www.cs.cornell.edu/~bindel/cims/matexpr/
However, my recommendation is that you just stick with the Eigen API
unless you want to spend three days learning a parsing tool like YACC
to do what you want.
Warm Regards,
Aron Ahmadia
On Fri, Feb 5, 2010 at 1:53 PM, Jinglei Hu <jingleihu@xxxxxxxxx> wrote:
> Hi guys,
>
> I knew from the Eigen developer that one can use array.segment(i, j) to get
> slice of an array. I'm wondering if it's possible to use array(i:j) to get
> slice just like Fortran.
>
> Cheers,
> Jinglei
>
>
>