Re: [eigen] HELP: deleting element in vector |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] HELP: deleting element in vector
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Thu, 28 Jun 2012 22:38:05 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=RZDFb4S9G+mTr8B5gDPS9mPJ/UPKwExIXwU5Sn84vbs=; b=Y+chreDLixPmndCBJNFvTUzURdFBnAfk6LZW9ykAPjfgJbED2M7udvM1albI6AxC3Q 1FdDuW97QztbsCuFy9HaF5fhVwHH3qQeQRXG2cwByNYRDHY6GpXbuFRH7dH+lELTuOEg Z06AA68omlMpV4ZhgerUd2w67Q2VY5I70SKPH1CD1kHuVBIXIJZrzGQSTbWv6Vq6QNk0 as1S9pCRr1atuT6/aZ6lDpgKxiwKkz0KhPSo6CB4UYjPmPdstJIq1jP0sAYWkCSm3Bb/ +EpDxRiUUOIph3JoTv57v9GAB4rkiR1VUiwGi61sMpPLTe03e8f3ZQ3lYmuwqi7wGeTA jp4g==
There is no easy way, but you can do:
int n = vec.size()-i-1;
vec.segment(i,n) = vec.tail(n);
vec.conservativeResize(vec.size()-1);
gael
On Thu, Jun 28, 2012 at 5:07 PM, Gaurav Gupta <gaurav71531@xxxxxxxxx> wrote:
> How can I delete a particular element in vector(index known) without joining
> creating separate head and tail
> and then joining them.