Re: [eigen] Quaternion initialization from Block/segment (Eigen 3 beta 1) |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Quaternion initialization from Block/segment (Eigen 3 beta 1)
- From: Jens Andersen <jens.andersen@xxxxxxxxx>
- Date: Thu, 22 Jul 2010 20:59:29 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:content-type:mime-version :subject:from:in-reply-to:date:content-transfer-encoding:message-id :references:to:x-mailer; bh=999fd8z/n1Le3s3OKQCMt2pHzwbdKGbEfbiiYHXwGYw=; b=s3/o3EE9oaM0uvVLN01aaSaoQ7FtYXyIPAhRHhjU6mXRwJILGK000PZ0htDD1FaLDQ xnTn0zeeh4LRsYKhzuKTlZ3eG/4RaHqVtsoVo8j/Vmktm14+rYJqMegxm8vjIdDhVRfs qRkt6uKBcMg6CoBYpN+Bf10FhBVAsBQ0WIJX0=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; b=dB02Cw7QjeYl+bY9jHPQvaIAmB7CKE2413aDisBhlKoHfy2ivTyaHhRCDvonLFk086 /yi6WrosYxW+TeYwR2M/orP25udY3wb2f42smyMXHtfVvU5ihqelBshMh4yLhsv+VXMc xAV/YapKQYQbY94ptDTAKmOSfae3LY+v7HNqE=
Thank you!
Works perfectly now :)
-Jens
On 22/07/2010, at 20.46, Gael Guennebaud wrote:
> On Thu, Jul 22, 2010 at 6:33 PM, Jens Andersen <jens.andersen@xxxxxxxxx> wrote:
>> Eigen::VectorXd myvector;
>> Eigen::Quaternion q(myvector.segment(3,4));
>>
>> I'm not sure whether this method avoids the copy?
>
> To make it compile you have to set the vector length at compile time:
>
> Eigen::Quaternion q(myvector.segment<4>(3));
>
> And indeed this copy the data to a new array. In Eigen3 you can map
> external memory as a Quaternion without any copy using Map:
>
> Map<Quaterniond> q(myvector.segment(3,4).data());
>
> or
>
> Map<Quaterniond> q(&myvector(3));
>
> gael
>
>