@@ -11,6 +11,12 @@ using LinearAlgebra
1111
1212MatrixAlgebraKit. iszerotangent (:: AbstractZero ) = true
1313
14+ @non_differentiable MatrixAlgebraKit. select_algorithm (args... )
15+ @non_differentiable MatrixAlgebraKit. initialize_output (args... )
16+ @non_differentiable MatrixAlgebraKit. check_input (args... )
17+ @non_differentiable MatrixAlgebraKit. isisometry (args... )
18+ @non_differentiable MatrixAlgebraKit. isunitary (args... )
19+
1420function ChainRulesCore. rrule (:: typeof (copy_input), f, A)
1521 project = ProjectTo (A)
1622 copy_input_pullback (ΔA) = (NoTangent (), NoTangent (), project (unthunk (ΔA)))
@@ -35,18 +41,12 @@ for qr_f in (:qr_compact, :qr_full)
3541 end
3642 end
3743end
38- function ChainRulesCore. rrule (:: typeof (qr_null!), A:: AbstractMatrix , N, alg)
44+ function ChainRulesCore. rrule (:: typeof (qr_null!), A, N, alg)
3945 Ac = copy_input (qr_full, A)
40- QR = initialize_output (qr_full!, A, alg)
41- Q, R = qr_full! (Ac, QR, alg)
42- N = copy! (N, view (Q, 1 : size (A, 1 ), (size (A, 2 ) + 1 ): size (A, 1 )))
46+ N = qr_null! (Ac, N, alg)
4347 function qr_null_pullback (ΔN)
4448 ΔA = zero (A)
45- (m, n) = size (A)
46- minmn = min (m, n)
47- ΔQ = zero! (similar (A, (m, m)))
48- view (ΔQ, 1 : m, (minmn + 1 ): m) .= unthunk .(ΔN)
49- MatrixAlgebraKit. qr_pullback! (ΔA, A, (Q, R), (ΔQ, ZeroTangent ()))
49+ MatrixAlgebraKit. qr_null_pullback! (ΔA, A, N, unthunk (ΔN))
5050 return NoTangent (), ΔA, ZeroTangent (), NoTangent ()
5151 end
5252 function qr_null_pullback (:: ZeroTangent ) # is this extra definition useful?
@@ -73,18 +73,12 @@ for lq_f in (:lq_compact, :lq_full)
7373 end
7474 end
7575end
76- function ChainRulesCore. rrule (:: typeof (lq_null!), A:: AbstractMatrix , Nᴴ, alg)
76+ function ChainRulesCore. rrule (:: typeof (lq_null!), A, Nᴴ, alg)
7777 Ac = copy_input (lq_full, A)
78- LQ = initialize_output (lq_full!, A, alg)
79- L, Q = lq_full! (Ac, LQ, alg)
80- Nᴴ = copy! (Nᴴ, view (Q, (size (A, 1 ) + 1 ): size (A, 2 ), 1 : size (A, 2 )))
78+ Nᴴ = lq_null! (Ac, Nᴴ, alg)
8179 function lq_null_pullback (ΔNᴴ)
8280 ΔA = zero (A)
83- (m, n) = size (A)
84- minmn = min (m, n)
85- ΔQ = zero! (similar (A, (n, n)))
86- view (ΔQ, (minmn + 1 ): n, 1 : n) .= unthunk .(ΔNᴴ)
87- MatrixAlgebraKit. lq_pullback! (ΔA, A, (L, Q), (ZeroTangent (), ΔQ))
81+ MatrixAlgebraKit. lq_null_pullback! (ΔA, A, Nᴴ, unthunk (ΔNᴴ))
8882 return NoTangent (), ΔA, ZeroTangent (), NoTangent ()
8983 end
9084 function lq_null_pullback (:: ZeroTangent ) # is this extra definition useful?
0 commit comments