@@ -36,8 +36,8 @@ function check_and_prepare_qr_cotangents(
3636 # compute the appropriate offset in ΔR so we aren't
3737 # operating on a view-of-view, which doesn't work
3838 # for GPU arrays
39- offset = LinearIndices (ΔR)[p + 1 , p + 1 ]
40- upper_inds = uppertriangularind (ΔR₂₂) .+ offset
39+ I = uppertriangularind (ΔR₂₂)
40+ upper_inds = view ( LinearIndices (ΔR), (p + 1 ) : minmn, (p + 1 ) : n)[I]
4141 ΔR₂₂upper = view (ΔR, upper_inds)
4242 Δgauge_R = norm (ΔR₂₂upper, Inf )
4343 Δgauge_R = max (Δgauge_R, norm (view (ΔR₂₂, diagind (ΔR₂₂)), Inf ))
@@ -84,7 +84,7 @@ function qr_pullback!(
8484
8585
8686 Q₁ = view (Q, :, 1 : p)
87- R₁₁ = UpperTriangular (view (R, 1 : p, 1 : p) )
87+ R₁₁ = UpperTriangular (R[ 1 : p, 1 : p] )
8888 R₁₂ = view (R, 1 : p, (p + 1 ): n)
8989
9090 ΔA₁ = view (ΔA, :, 1 : p)
@@ -110,7 +110,8 @@ function qr_pullback!(
110110 Md = diagview (M)
111111 Md .= real .(Md)
112112 end
113- ΔA₁ .+ = rdiv! (mul! (ΔQ₁, Q₁, M, + 1 , 1 ), R₁₁' )
113+ mul! (ΔQ₁, Q₁, M, + 1 , 1 )
114+ ΔA₁ .+ = rdiv! (ΔQ₁, R₁₁' )
114115 return ΔA
115116end
116117
0 commit comments