Re: [eigen] Bug with cwiseMin / cwiseMax

[ Thread Index | Date Index | More Archives ]

Hi Christof,

thanks for information. It is a little unexpected.

What are the rules for having a term in end result
as well as in input.
For example the doc/AsciiQuickReference.txt
has following line;
A += F;                // illegal in Eigen. In Matlab A = A+F is allowed

So, from this line it would seem that A = A + F is illegal in Eigen
and logically M1 = M1.cwiseMax(M2) as well.

What is the rule for this kind of problems?


On Mon, Jul 6, 2015 at 5:23 PM, Christoph Hertzberg <chtz@xxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Am 06.07.2015 um 17:16 schrieb Mathieu Dutour:
void PrintMatrix(MyMatrix<double> const& eMat)

Instead of that method, you can write:
  std::cerr << eMat;


This method does not change anything, but returns a new matrix (technically, a matrix _expression_). You can assign this to a new matrix or to either of M1/M2:
  M1 = M1.cwiseMax(M2);

Or you can directly print it:
  std::cerr << M1.cwiseMax(M2);

Or use it in other expressions:
  MyMatrix<double> M3 = M1.cwiseMin(M2) * M1.cwiseMax(M2);


Dipl.-Inf., Dipl.-Math. Christoph Hertzberg
Cartesium 0.049
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen

Tel: +49 (421) 218-64252

Mail converted by MHonArc 2.6.19+