Re: [eigen] Inverse of an array through .matrix() |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Inverse of an array through .matrix()
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Sun, 27 Jun 2010 08:21:03 -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=HlVtK5nxxl4yAQJFrLwLKSCqTQcWXGltN8r/o4S5tnY=; b=HSx80PhB2340jNweuztzNoH7Sky0MIDyFlJgjyWm4dhUV8eNWUGWQnzFH6loCN8xSL mb80qd+fV0sStn6CGC8pKLp+piClxqknB9cxU0DJ3PcmogmpU1H2n3s9hCpuRMA1vSUW m2a0ZOINsgJb/v7K3y2M2ULgg4DRPgve6DZU4=
- 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=cRx6H/b1DRRHz1jQlsYPT3huDWyHpFNCn5BR69g8Zr7MmYVxvsxmgOsnlROTV80ZYl xQHXVKkTvAzX58XhVXnwc1Jh6amt1F1S4KkQfl+FYQALtiQgssfkshEreoxYyYi7Vnry MfZHeEgSv80Sri6JNONeuvzjgwDZgdFD992h0=
2010/6/27 Carlos Becker <carlosbecker@xxxxxxxxx>:
> Hi everyone again. I am still writing some examples for the tutorials and
> came out with the following piece of code:
> #include <Eigen/Dense>
> #include <iostream>
> using namespace Eigen;
> using namespace std;
> int main()
> {
> ArrayXXf m(2,2);
> m << 1,2,3,4;
> // this compiles OK
> MatrixXf ww = m.matrix().inverse();
> // ERROR: no matching function for call to
> ‘Eigen::TriangularView<Eigen::Matrix<float, 33331, 33331, 0, 33331, 33331>,
> 2u>::solveInPlace(....
> ArrayXXf xx = m.matrix().inverse();
That can't work: m.matrix().inverse() wants to return a matrix
expression, so you can't assign that to an array expression. This
works:
ArrayXXf xx = m.matrix().inverse().array();
Notice that eigen3's .matrix() and .array() are very different from
eigen2's .cwise(): while .cwise() was just a prefix for the next
method call, .matrix() and .array() are permanently switching your
expression between the Matrix and Array worlds.
Please don't mention .inverse() in the Array page, as
- it is nontrivial linear algebra so should not be mentioned before
the linear algebra page
- implementation-wise it is very nontrivial and special, whence the
weird error messages that you got.
Benoit
> }
> I just wanted to ask if this is the way it should work or not, since I
> supposed that the last line should be fine.
> Thanks.