Re: [eigen] Using Eigen::Map to use eigen operations on my data |

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

*To*: eigen@xxxxxxxxxxxxxxxxxxx, Benoit Jacob <jacob.benoit.1@xxxxxxxxx>*Subject*: Re: [eigen] Using Eigen::Map to use eigen operations on my data*From*: Robert Lupton the Good <rhl@xxxxxxxxxxxxxxxxxxx>*Date*: Thu, 29 Oct 2009 17:21:16 -0400

float data[4] = { 1, 2, 3, 4 }; MatrixXf mat2x2 = MatrixXf(Map<MatrixXf>(data, 2, 2));Here you are constructing a new MatrixXf, mat2x2, from the map. after this line, mat2x2 is just another matrix and doesn't even remember that it was copied from the Map.

Map Any memory buffer can be mapped as an Eigen expression:

....

int data[4] = 1, 2, 3, 4; MatrixXi mat2x2 = Map<MatrixXi>(data,2,2);

Whereas this is in fact performing a copy.

If you want to initialize an array as the identity matrix, do: Map<MatrixXf>(data, 2, 2).setIdentity();

if you want to write your own function, make it like this: template<typename Derived> void identity(MatrixBase<Derived> *x)

R

**References**:**[eigen] Using Eigen::Map to use eigen operations on my data***From:*Robert Lupton the Good

**Re: [eigen] Using Eigen::Map to use eigen operations on my data***From:*Benoit Jacob

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] Using Eigen::Map to use eigen operations on my data** - Next by Date:
**Re: [eigen] Using Eigen::Map to use eigen operations on my data** - Previous by thread:
**Re: [eigen] Using Eigen::Map to use eigen operations on my data** - Next by thread:
**Re: [eigen] Using Eigen::Map to use eigen operations on my data**

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