|Re: [eigen] Custom expression type API stability|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
On Friday 19 February 2016 08:54:21 Gael Guennebaud wrote:
> On Fri, Feb 19, 2016 at 12:07 AM, Dan Čermák <dan.cermak@xxxxxxxxxxxxxxxxxxx
> > wrote:
> > Maybe a small follow-up to that, is it possible to append/prepend a value
> > to
> > (cond_vec>0).select(choice_vec.head(n-1), choice_vec.tail(n-1)) ? I want
> > to
> > extend this vector of length n-1 to length n, but not create an additional
> > vector along the way, so not something like this:
> > new_vec << 1, (cond_vec>0).select(choice_vec.head(n-1),
> > choice_vec.tail(n-1))
> > Actually its a tad more complicated than that, since I want to take the
> > choice
> > result, put it into head(n-1) add subtract it from tail(n-1) and add
> > values to
> > the first and last element (while doing the same again with another
> > expression).
> > Is there an elegant/efficient way how to do this? Or would it be best to
> > give
> > the function a reference to a result vector where to write the values
> > into?
> such manipulations cannot be efficiently abstracted through
> coefficient-wise expressions (you would need extra branches within the
> evaluation of a single coeff), so the best is to write your own function
> doing the the work inplace.
That seems doable, thanks for your help. And thanks for the eigen library,
it's really awesome!