JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.75k stars 5.49k forks source link

Not all Factorizations have Adjoint (namely QR varients) #38293

Closed oxinabox closed 3 years ago

oxinabox commented 4 years ago

Encountered during https://github.com/JuliaDiff/ChainRules.jl/pull/302 the simpler form is:

I am calling for example:

Af = factorize(A)
C1 = Af\B1
C2 = Af'\B2

Which I thought should be a faster way to do

C1 = A\B1
C2 = A'\B2

but it errors depending on the value of A. .e.g works if A is square since LU has Adjoint I am not sure if it works if positive definite since then it gets Cholesky which may or may not have Adjoint defined on it.

But neither QRPivoted nor QRCompactWY support adjoint I believe fixing this would also require adding a method for ldiv! on that adjoint.

Current status:

Some factorizations don't support \ at all

For sparse matrices,cholesky and lu already works and the sparse QR is tracked in https://github.com/JuliaLang/SuiteSparse.jl/issues/22

mschauer commented 4 years ago

Ref https://arxiv.org/pdf/1710.08717.pdf

oxinabox commented 4 years ago

Ref https://arxiv.org/pdf/1710.08717.pdf Wrong sense of adjoint

I mean adjoint on the QR object (i.e. turn it sidewise), not the abuse of terminology that is the adjoint of the function (i.e. find a linear operator that has the same rate of change, then find the linear operator that has as it's matrix form the adjoint of the first's matrix form)

dkarrasch commented 4 years ago

related: #35421

andreasnoack commented 3 years ago

Fixed by #40899