[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: [eigen] Casting matrices
- From: "Timothy Hunter" <tjhunter@xxxxxxxxxxxx>
- Date: Sun, 9 Nov 2008 15:45:12 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:mime-version:content-type:content-transfer-encoding :content-disposition:x-google-sender-auth; bh=DnRSjTx5fXRj0Zm9cmRPL41omKBdNR7vVrZmYthxzJw=; b=B6NHv08yvQ46PVyU1OT9FeuOFAi9BIgNv3kgo4dN0l7Yt/bf/1jL1gAfpD/Uo0CybZ kII0RImUuAzWicc3BdYR5OWFDPcADtufkq5NZi9EEalXQNnWvIeEimxX5E9tWHuPfOF1 yGA9vgX/Q8z18xa1MTWtoU5e5RImSdGVOL4Tc=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition:x-google-sender-auth; b=mNt3pZfmdtxjVpZp83G310tv650OThzwvJ/ZuKCOOqBnB1O+5EcODVBGtVcg6S+F2r p2uH+LdMB0o7rJwKn5j3D8F/SmUncMX+JZG0VrblZOX+oZ0N7vv0OYPuPLnOpseh2XUk myYjgognEbUBRgiEJo2W7QOVvifxF8ZvFMD+w=
Hello list,
I want to convert a Eigen::MatrixXi to a double * (already allocated
and of the right size).
A way to do it is to iterate:
for(int i=0;i<mat.rows();++i)
for(int j=0;j<mat.cols();++j)
double_ptr[i*mat.cols()+j] = static_cast<double>(mat(i,j));
However I would like to use MatrixXd::Map in this occasion.
More generally, it is not currently possible to do casting operations
like Vector3i = Vector3d and I want to add it on the wishlist if you
know of an elegant way to do it.
Best regards
Timothee Hunter
---