Skip to content

Commit

Permalink
temporary fix for T+P bandpower grad being zero
Browse files Browse the repository at this point in the history
  • Loading branch information
marius311 committed Mar 20, 2023
1 parent 92c731a commit 262f635
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/CMBLensing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ import Base: +, -, *, \, /, ^, ~, ≈, <, <=, |, &, ==, !,
import Base.Broadcast: materialize, preprocess, broadcasted
import Zygote.ChainRules: rrule
import LinearAlgebra: checksquare, diag, dot, isnan, ldiv!, logdet, mul!, norm,
pinv, StructuredMatrixStyle, structured_broadcast_alloc, tr
pinv, StructuredMatrixStyle, structured_broadcast_alloc, tr, det
import Measurements: ±
import Statistics: std
import ChainRules: ProjectTo
Expand Down
6 changes: 3 additions & 3 deletions src/field_vectors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,19 @@ promote_rule(::Type{F}, ::Type{<:Scalar}) where {F<:Field} = F
end

@auto_adjoint function sqrt(A::SA) where {SA<:StaticMatrix{2,2,<:DiagOp}}
a,c,b,d = A
a, c, b, d = A[1,1], A[2,1], A[2,1], A[2,2]
s = sqrt(a*d-b*c)
t = pinv(sqrt(a+(d+2s)))
SA([t*(a+s) t*b; t*c t*(d+s)])
end

@auto_adjoint function det(A::StaticMatrix{2,2,<:DiagOp})
a,c,b,d = A
a, c, b, d = A[1,1], A[2,1], A[2,1], A[2,2]
a*d-b*c
end

@auto_adjoint function pinv(A::SA) where {SA<:StaticMatrix{2,2,<:DiagOp}}
a,c,b,d = A
a, c, b, d = A[1,1], A[2,1], A[2,1], A[2,2]
idet = pinv(a*d-b*c)
SA([d*idet -(b*idet); -(c*idet) a*idet])
end
Expand Down

0 comments on commit 262f635

Please sign in to comment.