[eigen] Aliasing bug with Transpose, possibly a ReturnByValue problem |

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

*To*: eigen@xxxxxxxxxxxxxxxxxxx*Subject*: [eigen] Aliasing bug with Transpose, possibly a ReturnByValue problem*From*: Adrien Escande <adrien.escande@xxxxxxxxx>*Date*: Mon, 19 Jan 2015 15:57:38 +0900*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=PjoVFmTt3iwqutXyu/nx0Hv3vhSyWjbCYY791t4r8jw=; b=AggwNOiEZK+cXKY7MkuLLW7+YdNd8dMeyPPJOf41OWmPVSCzucOOCe1cjC9lKJ8hvg BDulLBN8Xrb4ZtOzGu+brLSiG4cv0Lf7DBw1FaKIOqNBFA9HXebrnrlayhD3zXcigYk8 TaFR58pKv3ByD2TpX/znJEeJuHa1nR0DOAlNnWuMTffCWDGEWJRkSka1lwg9x6v9Qhim bllkjPHJU0Z4roK/XzcoQktm8ArynK04LgAdwjB1SSPqymL3mz/QgsLbkguVIvetnHXI 26IyJ3VEj+PGhIHxss++5MZGyls/AjwwI7gE/j0ZuWdZ9pGzuC9RvObeQyMcEvtRLQhI AHFQ==

Dear all,

while browsing through Eigen's code, I found the following aliasing problem:#include <Eigen/Eigen>

#include <iostream>

using namespace Eigen;

int main()

{

VectorXd v = VectorXd::LinSpaced(15, 1, 15);

MatrixXd M = Map<MatrixXd>(v.data(), 5, 3);

Transpositions<Dynamic> T(3);

T[0] = 2; T[1] = 0; T[2] = 0;

MatrixXd M2 = T*M.topLeftCorner(3, 3);

std::cout << M2 << std::endl << std::endl;

M.bottomRightCorner(3, 3) = T*M.topLeftCorner(3, 3);

std::cout << M.bottomRightCorner(3, 3) << std::endl << std::endl;

}

1 6 11

3 8 13

2 7 12

which is correct

1 6 11

1 6 11

2 7 12

which is not.

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] sparse matrix setConstant method?** - Next by Date:
**[eigen] 3.2.4 released!** - Previous by thread:
**Re: [eigen] sparse matrix setConstant method?** - Next by thread:
**[eigen] 3.2.4 released!**

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