Skip to content

Commit

Permalink
Bugfix for when to use conditioning sets in rchol.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Geoga committed Jun 11, 2023
1 parent 18d7c18 commit d76ef14
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
1 change: 0 additions & 1 deletion example/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
BesselK = "432ab697-7a72-484f-bc4a-bc531f5c819b"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
NLopt = "76087f3c-5699-56af-9a33-bf431cd00edd"
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Vecchia = "8d73829f-f4b0-474a-9580-cecc8e084068"
12 changes: 6 additions & 6 deletions src/rcholesky.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,21 @@ function rchol_instantiate!(strbuf::RCholesky{T}, V::VecchiaConfig{H,D,F},
# get the buffer for this thread:
tbuf = bufs[i]
# get the data and points:
pts = V.pts[j]
dat = V.data[j]
idxs = V.condix[j]
pts = V.pts[j]
dat = V.data[j]
cov_pp = view(tbuf.buf_pp, 1:length(pts), 1:length(pts))
if isone(j)
if isempty(idxs)
# In this special case, I actually can skip the lower triangle.
updatebuf!(cov_pp, pts, pts, kernel, params, skipltri=true)
cov_pp_f = cholesky!(Symmetric(cov_pp))
buf = strbuf.diagonals[1]
ldiv!(cov_pp_f.U, buf)
else
# If j != 1, then I'm going to use an in-place mul! on this buffer, so I
# need to fill it all in.
# If the set of conditioning points is nonempty, then I'm going to use
# an in-place mul! on this buffer, so I need to fill it all in.
updatebuf!(cov_pp, pts, pts, kernel, params, skipltri=false)
# prepare conditioning points:
idxs = V.condix[j]
cpts = updateptsbuf!(tbuf.buf_cpts, V.pts, idxs)
# prepare and fill in the matrix buffers pertaining to the cond. points:
cov_cp = view(tbuf.buf_cp, 1:length(cpts), 1:length(pts))
Expand Down
2 changes: 1 addition & 1 deletion src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ end
# allocation happens once in a function call that will take a long time for real
# problems, so it doesn't seem worth the compiler stress.
function allocate_crchol_bufs(n::Int64, ::Val{D}, ::Val{Z},
cpts_sz, pts_sz) where{N,D,Z}
cpts_sz, pts_sz) where{D,Z}
[crcholbuf(Val(D), Val(Z), cpts_sz, pts_sz) for _ in 1:n]
end

Expand Down

0 comments on commit d76ef14

Please sign in to comment.