Re: [eigen] Re: Error when using the += operator on complex vectors

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


On Sat, Jul 24, 2010 at 9:34 PM, Christoph Hertzberg
<chtz@xxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> However, I would agree that addition and subtraction are unambiguous
> between arrays and matrices.

but shall we return an array or a matrix ? You might argue that we
could return a special kind of matrix which could be both and
depending on the context we would chose one or the other, but 1) that
would be overkill, and 2) we cannot always know:

(array1 + matrix1).sin()

(this assume matrix functions were directly available from MatrixBase
that is not the case, yet).

You might still argue that if an ambiguity is detected then fail on
the mixed array/matrix addition, but 1) now this would be "uberkill"
(!)  and 2) very strange that sometime array+matrix is allowed and
sometimes not.

So overall it seems to me to be much simpler, more consistent, and
more predictable to disallow array+matrix (and vise versa).

Consequently, since matrix += array is a shortcut for matrix = matrix
+ array and that matrix + array is forbidden, (IMO) it seems to be
consistent to disallow matrix += array too.

Cheers,

gael



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