Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when should inv(factorization) be another factorization? #32137

Open
StefanKarpinski opened this issue May 24, 2019 · 4 comments
Open

when should inv(factorization) be another factorization? #32137

StefanKarpinski opened this issue May 24, 2019 · 4 comments
Labels
design Design of APIs or of the language itself linear algebra Linear algebra

Comments

@StefanKarpinski
Copy link
Sponsor Member

This question came up here: #32094. I observed that once you've gone to the trouble of taking the SVD of a matrix and then taking an inverse (or pseudo-inverse), you may very well want to keep it in factorization form. Moreover, if we return a factorization object for an inverse, you can call Matrix on it to materialize the actual inverse, whereas we don't currently have a generic way of asking for the inverse factorization of a given factorization, but that is often something that can be computed efficiently.

@StefanKarpinski StefanKarpinski added linear algebra Linear algebra design Design of APIs or of the language itself labels May 24, 2019
@StefanKarpinski
Copy link
Sponsor Member Author

@stevengj
Copy link
Member

stevengj commented May 24, 2019

I guess. In many cases, like LU, computing the inverse factorization is more expensive than computing the inverse matrix, so it is nice to be able to get the latter without the former. There is also a question of motivation — I can’t recall ever needing or wanting the inverse factorization (at least, not explicitly: \ is enough).

@andreasnoack
Copy link
Member

andreasnoack commented Jun 18, 2019

As Steve points out, in quite a few cases it's not simple to compute/represent the inverse with another factorization. Even something as simple as the inverse of a Cholesky can't currently be represented with our factorization since our Cholesky is ◣◥ whereas the inverse is a "backward" Cholesky ◥ ◣.

My gut feeling is that, in general, you are interested in the elements of inverse, i.e. the dense matrix representation, when calling inv. In the special cases where it would be useful with, e.g. then inverse as an Eigen, it should be fairly simple to construct explicitly so I think I'd be in favor of always returning an AbstractMatrix from inv.

@dkarrasch
Copy link
Member

I agree. In #32094 I think I was mislead by the specifics of the SVD.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Design of APIs or of the language itself linear algebra Linear algebra
Projects
None yet
Development

No branches or pull requests

4 participants