Re: [eigen] Constructing a matrix by scalar* |

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]

*To*: eigen@xxxxxxxxxxxxxxxxxxx*Subject*: Re: [eigen] Constructing a matrix by scalar**From*: "Gael Guennebaud" <gael.guennebaud@xxxxxxxxx>*Date*: Thu, 27 Nov 2008 15:58:28 +0100*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type:references; bh=LAAN3iKDgFVhqNdy4AO9ptKMjRzxBFXjUumELDDwQcI=; b=owXNF2g9zpNVZP3urytDP11s4rHec2Cp4RmBBpKFgoY0rSRujmm+MD6dF/y8lcsNTX SaEpPQzCnzJbSOeGILTUQCs2oHz2n686D7ruG0W5RD5q/ECYiwDPna9F1NqaEqvLMnbJ cUDIEEccGB/hXWMiQ29zVJj/gmL7Zt7enVBNQ=*Domainkey-signature*: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:references; b=WWYYOTJS1sbQHyQ+09EqScb9Ij+nnVCz6BQGRmZQn/4bevSJrduxg1640f4+LwdP+R o/SIsBBOMoelaDOU13paFzta/aTTiRJkCvS2DJzOYdeTPeuE6W/ifQ7Qv61XbITOzvS4 MnGZyT1c0oa5yWjhAH1j+oTAqn9aeyNCpS2nw=

Hi,

typedef Map<Vector3f> Vector3fm;

then Vector3fm exactly represents what you were looking for. For instance:

float d[3] = {1,2,3};

Vector3fm v(d);

v += Vector3::Random();

there is no copy, v stores only a single pointer. You can also directly use a "Map" object:

Vector3f::Map(d) += Vector3::Random();

gael.

On Thu, Nov 27, 2008 at 3:45 PM, Benjamin Schindler <bschindler@xxxxxxxxxxxxxxx> wrote:

Hi

I'm currently working with vtk and it has a pretty ugly way of dealing with vectors /- /at least in my opinion. So I thought I could use eigen2 to do some of the fixed-size vector-math I'm doing. I found that Matrix has a data() function which returns a raw pointer to the data so that's good. But What I'm missing is a constructor which constructs a i.e. vector3f from a float pointer without copying the data. If I want to efficiently interact between vtk and eigen, I think this is very crucial.

Is this somehow possibel?

Thanks

Benjamin

---

**Follow-Ups**:**Re: [eigen] Constructing a matrix by scalar****From:*Gael Guennebaud

**References**:**[eigen] Constructing a matrix by scalar****From:*Benjamin Schindler

**Messages sorted by:**[ date | thread ]- Prev by Date:
**[eigen] Constructing a matrix by scalar*** - Next by Date:
**Re: [eigen] Constructing a matrix by scalar*** - Previous by thread:
**[eigen] Constructing a matrix by scalar*** - Next by thread:
**Re: [eigen] Constructing a matrix by scalar***

Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |