[eigen] Assignment of product to X.noalias() does not resize X |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
Hello,
What is the reason behind the following inconsistency (using the current
revision of the development branch)?
-------------
#include <Eigen/Core>
#include <Eigen/Array>
using namespace Eigen;
int main()
{
MatrixXf A = MatrixXf::Random(12,12);
MatrixXf A2;
A2 = A * A; // works
std::cout << A2(1,1) << std::endl;
MatrixXf A3(12,12);
A3.noalias() = A * A; // works
std::cout << A3(1,1) << std::endl;
MatrixXf A4;
A4.noalias() = A * A; // does NOT work
std::cout << A4(1,1) << std::endl;
}
-------------
The assignment to A4 complains (via a run-time assertion) that A4 has the
wrong dimension. Yet when we leave out the noalias(), as in the assignment
to A2, it does resize the matrix to the correct dimension.
In the 2.0 branch, A4 = (A * A).lazy() does resize the matrix A4.
Cheers,
Jitse