9696- complex case:
9797
9898$$
99- \bar{A} = \overline{\ bar{d} \cdot \det(A)} \cdot A^{-\mathsf{H}}.
99+ \bar{A} = \bar{d} \cdot \overline{ \det(A)} \cdot A^{-\mathsf{H}}.
100100$$
101101
102102## Singular matrix handling
@@ -107,9 +107,9 @@ still makes sense:
107107- rank $N-1$: the adjugate is rank 1 and can be reconstructed from an SVD
108108- rank $\le N-2$: the adjugate vanishes
109109
110- PyTorch's ` linalg_det_backward ` handles this regime by reconstructing the
111- leave-one-out singular- value products together with the orientation/phase factor
112- coming from $U$ and $V^{\mathsf{H}}$ .
110+ The rank-$N-1$ adjugate can be reconstructed from the leave-one-out singular
111+ value products together with the orientation/phase factor carried by the
112+ singular vectors .
113113
114114## 2. ` slogdet `
115115
129129
130130### Reverse Rule
131131
132- For the differentiable log-magnitude path:
132+ Given cotangents $\bar{s}$ for the sign output and $\bar{\ell}$ for the
133+ log-magnitude output:
133134
134135- real case:
135136
136137$$
137- \bar{A} = \overline{\operatorname{logabsdet} } \cdot A^{-\mathsf{T}}
138+ \bar{A} = \bar{\ell } \cdot A^{-\mathsf{T}}
138139$$
139140
140141- complex case:
141142
142143$$
143144\bar{A} = g \cdot A^{-\mathsf{H}},
144145\qquad
145- g = \overline{\operatorname{logabsdet}}
146- - i \operatorname{Im}(\overline{\operatorname{sign}}^* \operatorname{sign}).
146+ g = \bar{\ell} - i \operatorname{Im}(\bar{s}^* s),
147147$$
148148
149+ where $s = \operatorname{sign}(A)$.
150+
149151` slogdet ` is not differentiable at singular matrices because
150152$\operatorname{logabsdet} = -\infty$ there.
151153
152- ## Implementation Correspondence
153-
154- - ` tenferro-rs/docs/AD/det.md ` keeps both ` det ` and ` slogdet ` in one note and
155- discusses the singular adjugate path explicitly.
156- - PyTorch's ` linalg_det_jvp ` , ` linalg_det_backward ` , ` slogdet_jvp ` , and
157- ` slogdet_backward ` implement the same split and use solves rather than
158- explicit inverses.
159-
160154## Verification
161155
162156- compare primal ` det(A) ` and ` slogdet(A) ` with direct evaluation
0 commit comments