Skip to content

Commit edbf33f

Browse files
Micki-Doschulz
authored andcommitted
Fix bin search error
1 parent 84cac09 commit edbf33f

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

src/rqspline.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ function rqs_inverse(
303303
k2 = one(typeof(k1))
304304

305305
# Is inside of range
306-
isinside = (k1 < K) && (k1 > 0)
306+
isinside = (1 <= k1 <= K)
307307
k = Base.ifelse(isinside, k1, k2)
308308

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

354354
# Is inside of range
355-
isinside = (k1 < K) && (k1 > 0)
355+
isinside = (1 <= k1 <= K)
356356
k = Base.ifelse(isinside, k1, k2)
357357

358358
x_tmp = Base.ifelse(isinside, x[i,j], pX[k,i,j]) # Simplifies unnecessary calculations

src/utils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is a part of EuclidianNormalizingFlows.jl, licensed under the MIT License (MIT)
1+
# This file is a part of MonotonicSplines.jl, licensed under the MIT License (MIT)
22

33

44
# Non-public:

test/test_rqspline.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ for compute_unit in compute_units
105105
YM = fM(XM)
106106
@test @inferred(broadcast(inv_f, Y)) == vec(@inferred(inv_fM(YM)))
107107

108-
# See issue #17:
109-
@test_broken inv_f.(Y) X
108+
@test inv_f.(Y) X
110109

111110
Y_ladj = @inferred(broadcast(with_logabsdet_jacobian, f, X))
112111
YM_ladj = @inferred(with_logabsdet_jacobian(fM, XM))

0 commit comments

Comments
 (0)