Re: [eigen] Re: Error when using the += operator on complex vectors |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Re: Error when using the += operator on complex vectors
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Sun, 25 Jul 2010 00:14:07 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:content-type; bh=Lt+gMriAWQGLc6ysPVaxFV6bwvV7HySNJFO7Rmjahmc=; b=g9xAcj15dKrLFq8LTHJTi1yjLjZb/hx4bvRXLIOk7Y/yYK/2n2VdhfkX2gQb0XkQNZ GtbqNIT7XwiVUuE8X3eU5BjZcwq2WJqDvAg5jWsjSsZDcYaStTcd1YI7D5tOE3M0Otcv GrFm9K26kOyuUY0crJxGW3Jp4JSQZN/brNjKA=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=vz/wR7UVfRTr8oMg8yRevNZbSahXEPpBVkoygdEeQFSujp/ZbGdPIIzBeEFC4g1J12 xGxcsnVLp3DOED2386D8R6lq4jGId/vcu6cpwb8zq3Rk5tjRq46l3hGCNBVyrD6h5mHh vLo6gImybDtIAK5DKZvdTrrRjE0btck7JtEDE=
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