JuliaDiff / JuliaDiff/ChainRules.jl

Rules for det are not general and likely unstable

Open
#468 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
475
Forks
98
PR merge metrics
No merged PRs in 30d

Description

A = [1.0 1.0; 1.0 1.0] 
det(A) * inv(A) 
# ERROR: SingularException(2)

to be fair, the LU approach is remarkably resiliant...

A = [1.0 1.0; 1.0 1.0-1e-16]
det(A) * inv(A)
# 2×2 Matrix{Float64}:
#   1.0  -1.0
#  -1.0   1.0

But I am nervous that this is too simple a special case to draw any conclusions.

Either way - it seems to me that an implementation that always works and is guaranteed numerically stable is preferrable. If the maintainers agree, then I would be happy to make a PR and implement frule and rrule via SVD instead of LU.

Questions:

  • should the det evaluation then also use SVD, or should it use whichever the standard implementation is?
  • should the SVD implementation be only for a specific class of matrices, or general? E.g. I'm unsure about sparse.
  • I noticed that there are rules for svd - I'm guessing this means one will be able to differentate the frule or rrule based on SVD?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing rules for det, inv, frule, rrule, and svd, then compare the LU and SVD approaches described in the issue. Before implementation, resolve whether det should use SVD, whether the rule should cover sparse matrices, and what numerical-stability guarantee is required; done means an agreed general design is implemented and its behavior is validated.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
devtools
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.