Re: [eigen] Array question (maybe a bug) |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Array question (maybe a bug)
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Mon, 18 Jan 2010 22:58:33 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=/DtDPXLdRPi7ymJFh2S+bWdQalUOsGPv6fMnp/ks9RQ=; b=st/+N8K6KhgKmSgiQNcoUDoQzedDG8eEmdSBQ+xcemQ/f7RIy6LCXXhJy6SvPMgpLB cO3sJStRNBpFljF5fRMPta2TNyFPKmb1E3p3RaIzBl/e6BYFspuXMljrG0vAqMfGakkK CWKeLYxSLPP8b4nbVM4NVBmnZtGMI68o8h94A=
- 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:content-transfer-encoding; b=nQ4Xl088UM6FlsQtdAzJWh3tDsuUJob8w/TcM9AjNmtLpgpcAIoET4MFLNtzl6TEy1 a9P040whbpQYfHBCKkrZZTigddXor9INz2FP5+zrvghaD/LktwoAdFm9tue6dksWiTIo tn/K1bPE8mwJb/huauxJIMWfMbaQL9cqwvTRI=
oops, that's fixed now.
gael
On Mon, Jan 18, 2010 at 6:37 PM, Trevor Irons <trevorirons@xxxxxxxxx> wrote:
> Is this expected?
>
> #include "Eigen/Core"
> #include "Eigen/Array"
>
> using namespace Eigen;
>
> int main() {
> VectorXd y(3);
> double rams=1.25;
> VectorXd kk(4);
> kk << 0.1, -0.1, -0.1, .1;
> y = rams-kk.array(); // Wrong answer
> //y = -kk.array()+rams; // OK
> for (int i=0; i<4; ++i) {
> std::cout << y[i] << "\t" << (rams - kk[i]) << std::endl;
> }
> return 0;
> }
>
> Returns, where I was thinking they would be equivalent.
>
> tirons@baboon:~/sandbox/eigen$ ./min
> -1.15 1.15
> -1.35 1.35
> -1.35 1.35
> -1.15 1.15
>
> I get the expected answer with -kk.array() - rams.
> Is this a bug, or am I missing something with how array's work?
>
> Thanks,
> Trevor
>