Skip to content

Commit f4ca90d

Browse files
ErikQQYsethaxen
andauthored
Dispatch on invunwhiten! from PDMats (#250)
* Dispatch on invunwhiten! from PDMats * Typo * Fix tests * Increment patch number * Remove outdated comment --------- Co-authored-by: Seth Axen <[email protected]>
1 parent ecaf581 commit f4ca90d

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Pathfinder"
22
uuid = "b1d3bc72-d0e7-4279-b92f-7fa5d6d2d454"
33
authors = ["Seth Axen <[email protected]> and contributors"]
4-
version = "0.9.16"
4+
version = "0.9.17"
55

66
[deps]
77
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
@@ -50,7 +50,7 @@ Optim = "1.7.2"
5050
Optimization = "3.21, 4"
5151
OptimizationNLopt = "0.2, 0.3"
5252
OptimizationOptimJL = "0.2.1, 0.3, 0.4"
53-
PDMats = "0.11.26"
53+
PDMats = "0.11.35"
5454
PSIS = "0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9"
5555
ProgressLogging = "0.1.4"
5656
Random = "1"

src/integration/advancedhmc.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function Base.rand(
7070
) where {T}
7171
M⁻¹ = metric.M⁻¹
7272
r = randn(rng, T, size(metric)...)
73-
invunwhiten!(r, M⁻¹, r)
73+
PDMats.invunwhiten!(r, M⁻¹, r)
7474
return r
7575
end
7676

src/woodbury.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,8 +414,7 @@ function PDMats.whiten!(
414414
return ldiv!(pdfactorize(W).L, r)
415415
end
416416

417-
# similar to unwhiten!(r, inv(W), x) but without the inversion
418-
function invunwhiten!(
417+
function PDMats.invunwhiten!(
419418
r::AbstractVecOrMat{T}, W::WoodburyPDMat, x::AbstractVecOrMat{T}
420419
) where {T}
421420
copyto!(r, x)

test/woodbury.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,18 +358,18 @@ end
358358
_, R = factorize(W)
359359

360360
x = randn(T, n)
361-
@test @inferred(Pathfinder.invunwhiten!(similar(x), W, x)) R \ x
361+
@test @inferred(invunwhiten!(similar(x), W, x)) R \ x
362362

363363
X = randn(T, n, 100)
364-
@test @inferred(Pathfinder.invunwhiten!(similar(X), W, X)) R \ X
364+
@test @inferred(invunwhiten!(similar(X), W, X)) R \ X
365365
end
366366

367367
@testset "quad/quad!" begin
368368
x = randn(T, n)
369369
@test @inferred(quad(W, x)) dot(x, Wmat, x)
370370

371371
u = randn(T, n)
372-
@test quad(W, Pathfinder.invunwhiten!(similar(u), W, u)) dot(u, u)
372+
@test quad(W, invunwhiten!(similar(u), W, u)) dot(u, u)
373373

374374
X = randn(T, n, 10)
375375
quad_W_X = @inferred quad(W, X)
@@ -379,7 +379,7 @@ end
379379
@test quad_W_X2 quad_W_X
380380

381381
U = randn(T, n, 10)
382-
@test quad(W, Pathfinder.invunwhiten!(similar(U), W, U))
382+
@test quad(W, invunwhiten!(similar(U), W, U))
383383
vec(sum(abs2, U; dims=1))
384384
end
385385

0 commit comments

Comments
 (0)