Re: [eigen] initialize vector3d from array |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] initialize vector3d from array
- From: Sergiu Dotenco <sergiu.dotenco@xxxxxxxxx>
- Date: Fri, 6 Nov 2015 10:43:46 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type:content-transfer-encoding; bh=EEHtmiCjHpW4QZ+IrEvzKzoFyTheNIzaCZMZQOaR6lI=; b=Qzq9qeElWx7Lp+2rf7VaomEYfj+YBOa/SR+2w1BcFVOUr6MQ5KcjmtkdqFfDQajshc sKqGxPx+NuDKDxDXSn9EuDE/1S4E87T3+zD9oQP3mYy/u+eY93qTSnDoFkg3I7L4b8M/ aieDsvjCl7+44FPM5HpxTXY/ge0zgvZurvfv+AFeL2mf4mKdkbjO3EuKAJZGgptl+DMx jBTkLHb7q9j8NjwxBCGOXnhEPHigD1k+laUICcDfQJgDh8J8q8n+nuxxSsjb+dOERMof eTSGkLilLkLYraHGqFRouk57twFIdF/yhHcZ4mKN5vKrP02nVdnRQk2E5KGD/xQeawIQ EISA==
On 11/6/2015 2:01 AM, Nico Schlömer wrote:
> Hi everyone,
>
> I have a large array with the data organized like
> ```
> x0, y0, z0, x1, y1, z1, ...
> ```
> I would like to create some `const Vector3d` from these. How can I do
> that most efficiently?
>
> Cheers,
> Nico
You can use a map:
double a[] = { ... };
Eigen::Map<const Eigen::Vector3d> > vec1(a);
Eigen::Map<const Eigen::Vector3d> > vec2(a + 3);
and so on.