Skip to content

Commit f52a9c5

Browse files
authored
Fix infinite recursion in CorrBijector/VecCorrBijector (#355)
1 parent 55501ae commit f52a9c5

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "Bijectors"
22
uuid = "76274a88-744f-5084-9051-94815aaf08c4"
3-
version = "0.15.1"
3+
version = "0.15.2"
44

55
[deps]
66
ArgCheck = "dce04be8-c92d-5529-be00-80e4d2c0e197"

src/bijectors/corr.jl

+6-6
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ struct CorrBijector <: Bijector end
6565

6666
with_logabsdet_jacobian(b::CorrBijector, x) = transform(b, x), logabsdetjac(b, x)
6767

68-
function transform(b::CorrBijector, X::AbstractMatrix{<:Real})
68+
function transform(b::CorrBijector, X)
6969
w = cholesky_upper(X)
7070
r = _link_chol_lkj(w)
7171
return r
7272
end
7373

74-
function with_logabsdet_jacobian(ib::Inverse{CorrBijector}, y::AbstractMatrix{<:Real})
74+
function with_logabsdet_jacobian(ib::Inverse{CorrBijector}, y)
7575
U, logJ = _inv_link_chol_lkj(y)
7676
K = size(U, 1)
7777
for j in 2:(K - 1)
@@ -80,8 +80,8 @@ function with_logabsdet_jacobian(ib::Inverse{CorrBijector}, y::AbstractMatrix{<:
8080
return pd_from_upper(U), logJ
8181
end
8282

83-
logabsdetjac(::Inverse{CorrBijector}, Y::AbstractMatrix{<:Real}) = _logabsdetjac_inv_corr(Y)
84-
function logabsdetjac(b::CorrBijector, X::AbstractMatrix{<:Real})
83+
logabsdetjac(::Inverse{CorrBijector}, Y) = _logabsdetjac_inv_corr(Y)
84+
function logabsdetjac(b::CorrBijector, X)
8585
#=
8686
It may be more efficient if we can use un-contraint value to prevent call of b
8787
It's recommended to directly call
@@ -135,7 +135,7 @@ function logabsdetjac(b::VecCorrBijector, x)
135135
return -logabsdetjac(inverse(b), b(x))
136136
end
137137

138-
function with_logabsdet_jacobian(::Inverse{VecCorrBijector}, y::AbstractVector{<:Real})
138+
function with_logabsdet_jacobian(::Inverse{VecCorrBijector}, y)
139139
U_logJ = _inv_link_chol_lkj(y)
140140
# workaround for `Tracker.TrackedTuple` not supporting iteration
141141
U, logJ = U_logJ[1], U_logJ[2]
@@ -146,7 +146,7 @@ function with_logabsdet_jacobian(::Inverse{VecCorrBijector}, y::AbstractVector{<
146146
return pd_from_upper(U), logJ
147147
end
148148

149-
function logabsdetjac(::Inverse{VecCorrBijector}, y::AbstractVector{<:Real})
149+
function logabsdetjac(::Inverse{VecCorrBijector}, y)
150150
return _logabsdetjac_inv_corr(y)
151151
end
152152

0 commit comments

Comments
 (0)