Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix bin search error #22

Merged
merged 1 commit into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/rqspline.jl
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ function rqs_inverse(
k2 = one(typeof(k1))

# Is inside of range
isinside = (k1 < K) && (k1 > 0)
isinside = (1 <= k1 <= K)
k = Base.ifelse(isinside, k1, k2)

x_tmp = Base.ifelse(isinside, x, pX[k]) # Simplifies unnecessary calculations
Expand Down Expand Up @@ -352,7 +352,7 @@ end
k2 = one(typeof(k1))

# Is inside of range
isinside = (k1 < K) && (k1 > 0)
isinside = (1 <= k1 <= K)
k = Base.ifelse(isinside, k1, k2)

x_tmp = Base.ifelse(isinside, x[i,j], pX[k,i,j]) # Simplifies unnecessary calculations
Expand Down
2 changes: 1 addition & 1 deletion src/utils.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is a part of EuclidianNormalizingFlows.jl, licensed under the MIT License (MIT)
# This file is a part of MonotonicSplines.jl, licensed under the MIT License (MIT)


# Non-public:
Expand Down
3 changes: 1 addition & 2 deletions test/test_rqspline.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ for compute_unit in compute_units
YM = fM(XM)
@test @inferred(broadcast(inv_f, Y)) == vec(@inferred(inv_fM(YM)))

# See issue #17:
@test_broken inv_f.(Y) ≈ X
@test inv_f.(Y) ≈ X

Y_ladj = @inferred(broadcast(with_logabsdet_jacobian, f, X))
YM_ladj = @inferred(with_logabsdet_jacobian(fM, XM))
Expand Down