shabbychef / madness

Multivariate Automatic Differentiation R package
GNU Lesser General Public License v3.0
31 stars 0 forks source link

Schur(qz) decomposition #20

Open thorek1 opened 4 years ago

thorek1 commented 4 years ago

Thanks for maintaining the package. It is very useful, yet missing a crucial part for my applications: Schur(qz) decomposition - e.g. QZ::qz(QZ::exAB2$A, QZ::exAB2$B)

I did not find any implementation of it around.

Do you think this is feasible?

shabbychef commented 4 years ago

Thanks for your interest in the package. I am not sure how I would approach this problem. I also am not so familiar with the Q-Z decomposition. Can this be derived somehow from the generalized eigenvalue decomposition?

As you probably have guessed, this package computes derivatives by hand-coding the derivatives of certain operations, and using the chain rule. A more effective forward differentiation scheme can be found in the Julia JuliaDiff package, which replaces low level numerical computations with those that carry derivatives forward. This is not really possible in R where we delegate complicated operations to C code.

thorek1 commented 4 years ago

I am also not sure how to do it.

What you are saying about the generalized eigenvalue decomposition sounds like a good idea and I found this post which seems relevant: https://mathoverflow.net/questions/229425/derivative-of-eigenvectors-of-a-matrix-with-respect-to-its-components

That would still leave all other 4 matrices (Q,Z,S,T).

I looked a bit around as well and checked out JAX (python) but they don’t have it and JuliaDiff, which telling from the documentation doesn’t have it either.