[eigen] Array question (maybe a bug)
[
Thread Index
|
Date Index
|
More lists.tuxfamily.org/eigen Archives
]
To
:
eigen@xxxxxxxxxxxxxxxxxxx
Subject
: [eigen] Array question (maybe a bug)
From
: Trevor Irons <
trevorirons@xxxxxxxxx
>
Date
: Mon, 18 Jan 2010 10:37:27 -0700
Dkim-signature
: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=K8NURhTmwfpPvBIZs53EJKSa2B+pGpL2ZSxTBN6wn1s=; b=btxGdUMPb1srQG1Wa+dU9RcK3fasjqihDauZBX7b/Vg+ooCvi45xLnZ0l8CH6u0kRd fyETaOS8D3A7f4IZEBSqYKF9WqJ439SlKURCrfHh6qFq7N6JkQ0wjBdvLUTvc0Pem6tC hYpTKGr73S1nP1TrM88zWXM3LZslGkbaRsVFQ=
Domainkey-signature
: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=xr9tIY3S3a947xY6rvYGphU/Vxv03WoezTup0MXvFcyyKdt/TZy2tCRX2v4128ayNX rj3mfMcNV6UYf98RJL8VLHdJNktxXIKUhPSO/R/PPCDBpXjzXIN9XbRx0gelH+ElyBND pmOG3HnKmBnuVWTWV6ryaORWB6NnZRZM8QGL0=
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
Follow-Ups
:
Re: [eigen] Array question (maybe a bug)
From:
Gael Guennebaud
Messages sorted by:
[
date
|
thread
]
Prev by Date:
[eigen] Polynomial solver, eigenvalues of companion matrix and balancing
Next by Date:
Re: [eigen] Polynomial solver, eigenvalues of companion matrix and balancing
Previous by thread:
Re: [eigen] Polynomial solver, eigenvalues of companion matrix and balancing
Next by thread:
Re: [eigen] Array question (maybe a bug)
Mail converted by
MHonArc
2.6.19+
http://listengine.tuxfamily.org/