Re: [eigen] solve API
• To: eigen@xxxxxxxxxxxxxxxxxxx
• Subject: Re: [eigen] solve API
• From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
• Date: Mon, 28 Jun 2010 22:35:12 +0200
• 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=Fr/KcAR6Rob+6mOB2kHNJ8oUvplWVDLBVK/GtfY2u8eyKtvXM+A/5ZMVZuavUgsRvK ThzvfWwGRgZGA/OOXpsJN4xZ7dqVxD2IT6nq8+dIys50bNZmdYx+p3la96wQYe2eEwyV Y2FupnAkUslLovki+WsblozASewe4cEKMy1Ew=

```On Mon, Jun 28, 2010 at 8:30 PM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:
But I've never seen A^-1 B used when A isn't injective. In that
> case, one says in plain text "let X be a solution of AX=B". There is
> no way to write that as a formula.

yes that's very true...

> So I see your point in the invertible case, but I feel that there is a
> problem in the non-invertible case. Since invertibility is a numerical
> issue, I agree not to let it impact the API. But at least, non-square
> matrices should be banned.
>
>  - call it solver() in the general case
>  - add inverse() as another method that checks that the matrix is
> square, and returns solver().
>
> Of course, in all decompositions that are restricted to square
> matrices, no need for solver(), so this amounts to just your proposal:
> inverse().

my problem is that I really want a uniform API from diagonal matrix to
SVD, including triangular and permutation. So for uniformity we should
also add solver() (or pseudoInverse() or whatever) to
DiagonalMatrixBase, to Permutation, etc... Having both everywhere
makes no sense, they would always return the same thing, the only
difference being that for QR and SVD inverse() would trigger an assert
if the matrix is not square.

Is it so bad to have: SVD::inverse() actually returns a pseudo-inverse
with big warnings in the documentation ?

We could also have a pseudoInverse() alias for QR and SVD, but keeping
inverse() valid for rectangular matrix.

gael

>
> Benoit
>

```

 Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/