Re: [eigen] Strange initialization |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Strange initialization
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Sat, 10 Jul 2010 05:34:15 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=hlK8HCZBHsCxInFZqHEomCIekXUUbQDDSt+9+js/2Rk=; b=FI1TcRNaNo6nR6sS7DrcriW0aIberT3InvOvhWQ12cr+Rb5w9FLSuL9vyVrwRhnIeH ZJZHZnvaipLt9+mjzy1MkUpmEcWWKsa2p0Vddc+c3L2xBdCvBGg8GISDt9cIIL1rfSZU 0sIDmguSDIEXDNbPaQ8+J869X2DWK1G11Wcbc=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=rG0rNPGmwTxrHEm/3wRJqH6ML7yRsmI7DzqzfTg6o365pvIQ7ipXn8CS1uSb99mpwq +4H7i+DHUUdNwOJQ3CRPskQPujDFci31+RG6pqIj7j4nnXtrIogD0FraKvdakbRKWN8w s+ghZEUAiiDPwaFH4KhxhHYJwWlSTMGnf9TJk=
2010/7/10 Helmut Jarausch <jarausch@xxxxxxxxxxxxxxxxxxx>:
> Could someone please explain why the second initialization
> below is accepted and what it is doing?
>
> Many thanks,
> Helmut.
>
>
> #include <iostream>
> #include <Eigen/Core>
>
> using Eigen::Matrix2i; using Eigen::Map;
>
> int main() {
> int data[4] = {1, 2, 3, 4};
> // This works as documented
> Map<Matrix2i> m2x2(data,2,2);
> std::cout << m2x2 << std::endl;
>
> // but what happens here ?
> Matrix2i mat2x2(data); // accepted but
> std::cout << mat2x2 << std::endl;
> /* output 0 3
> 0 4
> */
> }
I can't reproduce this with gcc 4.4, for me your test program always
prints as expected:
1 3
2 4
1 3
2 4
I have tried
- eigen2 and eigen3
- with and without vectorization
- with and without -O2
What compiler and command line are you using?
Benoit
>
>
> --
> Helmut Jarausch
>
> Lehrstuhl fuer Numerische Mathematik
> RWTH - Aachen University
> D 52056 Aachen, Germany
>
>
>
>