Skip to content

Commit

Permalink
Fix occasional positive definite problem.
Browse files Browse the repository at this point in the history
  • Loading branch information
RomeoV committed May 24, 2024
1 parent 5589c72 commit 2ebfe01
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion benchmarks/runbenchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ for est_t in [MCMCEstimator, LSQEstimator, LinearApproxEstimator]
xs = rand($nsamplesdict[$size])
n = length(xs)
corrnoise = let n = 2*n
1/10 * I(n) * MvNormal(zeros(n), I(n) + 1/5*hermitianpart(rand(n, n)))
Σ = zeros(n, n)
while !isposdef(Σ); Σ .= I(n) + 1/5*hermitianpart(rand(n, n)); end
1/10 * I(n) * MvNormal(zeros(n), Σ)
end
noisemodel = CorrGaussianNoiseModel(corrnoise)
ysmeas = maybeflatten($f.(xs, [$θtrue])) .+ rand(corrnoise)
Expand Down
5 changes: 4 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,11 @@ end
n = length(xs)
# because observation are two dimensional
corrnoise = let n = 2*n
1/10 * I(n) * MvNormal(zeros(n), I(n) + 1/5*hermitianpart(rand(n, n)))
Σ = zeros(n, n)
while !isposdef(Σ); Σ .= I(n) + 1/5*hermitianpart(rand(n, n)); end
1/10 * I(n) * MvNormal(zeros(n), Σ)
end

noisemodel = CorrGaussianNoiseModel(corrnoise)

ysmeas = reduce(vcat, f.(xs, [θtrue])) .+ rand(corrnoise)
Expand Down

0 comments on commit 2ebfe01

Please sign in to comment.