[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] solve API
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Mon, 28 Jun 2010 20:16:51 +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 :content-transfer-encoding; bh=FcOzm1ARjLqIKTRrYKPm3CCA75jYBsJ17a6KuNWtt38=; b=wbwwBTLMz2tVHTSDLM5woxgNOMlqwFmzR8ICVxFh+bPAHNM+tNsKXYUsOCeGqV0XEs J/2cJ0mh3lx3Sa8XKz5UV8Zdb3J3GhwTGmnAP/3U80pRY4bX7fpeHKPJrkoElEvQKvGt p9a6zwOSNamuy3Lp+bU3+PNvccSo729sEg4l0=
- 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=sKr/JAXOP6Phe2XOXDwECsMuxMnp2EDEFlpg2m2PbjJZRFaNuzzJM60PHcBazfWg7Z WYcdhaaKVYZ/pxeTS6DDOzjEPJpCSZLqz9uY5raab5qQt4H5ORLAhRhtPH56F4RZmTuK +RNzQbicpqCb/fojZK4RpERiBdI3Cfk3rOSUk=
On Mon, Jun 28, 2010 at 5:15 PM, FMDSPAM <fmdspam@xxxxxxxxx> wrote:
> Just my 2 cent:
> I know, that expression do not have to be evaluated but nevertheless
> I would try to avoid the word "inverse()", because of lession #1: "Never use
> matrix inversion".
This rule exists only because of the poor implementation/API of the
other libs ;)
I'm kidding, I see your point, but I don't see it as a strong argument
In books you never use "solve" in your mathematical formula, but
always write, e.g., A^1 B. Wouldn't it be convenient to be able to
write code which closely follow what you found in a textbook, or to
write code as you write formulas on your paper sheets without worrying
about performance? Actually, I'm pretty sure that many newcomers to
linear algebra do not know about these details, and simply write what
they read in their favorite book: A.inverse() * B (I've seen that
several times). So if A.inverse() would return a A.lu().inverse()
proxy, then no more worry.
> What about
> x = b * A.adjoint().lu().invertor() (like benoit's solver())
As I said to Manoj, this is not equivalent to have the adjoint applied
on the inverse proxy (lu.inverse().adjoint()) because I want to be
able to use the LU dec to solve both adjoint and non adjoint problems.
So it should be:
x = lu.invertor() * b;
y = lu.invertor().adjoint() * b;
but "invertor().adjoint()" is a bit weird. Nonetheless, I prefer
invertor() to solve() or solver().
> But cleaner for me to read is, what Manoj suggesting:
>> x = solve(A,b); // left
>> x = solve(b,A); // right
>> x = solve(b, A.triangularView<Lower>()); // Gael's example
> It's OK to read and understand w/o scarring about "inverse()" too.
it is really ambiguous because
x = solve(b,A);
can mean x = b^-1 A, and anyway this proposal works at a different
level that the one we are considering.