Skip to content

Commit

Permalink
JuliaFormatter.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanaelbosch committed Feb 6, 2024
1 parent 0540381 commit 3f00f06
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 19 deletions.
2 changes: 0 additions & 2 deletions src/checks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ end
function check_densesmooth(integ)
if integ.opts.dense && !integ.alg.smooth
error("To use `dense=true` you need to set `smooth=true`!")
# elseif !integ.opts.dense && integ.alg.smooth
# @warn "If you set dense=false for efficiency, you might also want to set smooth=false."
end
if !integ.opts.save_everystep && integ.alg.smooth
error("If you do not save all values, you do not need to smooth!")
Expand Down
2 changes: 0 additions & 2 deletions src/covariance_structure.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ to_factorized_matrix(::DenseCovariance, M::AbstractMatrix) = Matrix(M)
to_factorized_matrix(::IsometricKroneckerCovariance, M::AbstractMatrix) =
error("Cannot factorize Matrix")
to_factorized_matrix(::IsometricKroneckerCovariance, M::IsometricKroneckerProduct) = M
to_factorized_matrix(FAC::IsometricKroneckerCovariance, M::Diagonal{T, <:Fill{T, 1}}) where {T} =
IsometricKroneckerProduct(FAC.d, M.diag.value*Eye(FAC.q+1))

for FT in [:DenseCovariance, :IsometricKroneckerCovariance]
@eval to_factorized_matrix(FAC::$FT, M::PSDMatrix) =
Expand Down
19 changes: 9 additions & 10 deletions src/data_likelihoods/dalton.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,20 @@ function dalton_data_loglik(
args...;
# observation model
observation_matrix=I,
observation_noise_cov::Union{Number, AbstractMatrix},
observation_noise_cov::Union{Number,AbstractMatrix},
# data
data::NamedTuple{(:t, :u)},
kwargs...
kwargs...,
)

if alg.smooth
str = "The passed algorithm performs smoothing, but `dalton_nll` can be used without. " *
str =
"The passed algorithm performs smoothing, but `dalton_nll` can be used without. " *
"You might want to set `smooth=false` to imprpove performance."
@warn str
end
if !(:adaptive in keys(kwargs))
throw(ArgumentError("`dalton_nll` only works with fixed step sizes. Set `adaptive=false`."))
str = "`dalton_nll` only works with fixed step sizes. Set `adaptive=false`."
throw(ArgumentError(str))
end

if :tstops in keys(kwargs)
Expand Down Expand Up @@ -68,10 +69,8 @@ function dalton_data_loglik(
tstops,
)

dalton_ll = (data_ll.ll
+ sol_with_data.pnstats.log_likelihood
- sol_without_data.pnstats.log_likelihood)

sol_with_data_pn_ll = sol_with_data.pnstats.log_likelihood
sol_without_data_pn_ll = sol_without_data.pnstats.log_likelihood
dalton_ll = data_ll.ll + sol_with_data_pn_ll - sol_without_data_pn_ll
return dalton_ll
end

4 changes: 2 additions & 2 deletions src/data_likelihoods/fenrir.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function fenrir_data_loglik(
observation_noise_cov::Union{Number,AbstractMatrix},
# data
data::NamedTuple{(:t, :u)},
kwargs...
kwargs...,
)
if !alg.smooth
throw(ArgumentError("fenrir only works with smoothing. Set `smooth=true`."))
Expand Down Expand Up @@ -64,7 +64,7 @@ end

function fit_pnsolution_to_data!(
sol::AbstractProbODESolution,
observation_noise_var::Union{Real, AbstractMatrix},
observation_noise_var::Union{Real,AbstractMatrix},
data::NamedTuple{(:t, :u)};
proj=I,
)
Expand Down
7 changes: 4 additions & 3 deletions src/data_likelihoods/filtering.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ function filtering_data_loglik(
args...;
# observation model
observation_matrix=I,
observation_noise_cov::Union{Number, AbstractMatrix},
observation_noise_cov::Union{Number,AbstractMatrix},
# data
data::NamedTuple{(:t, :u)},
kwargs...
kwargs...,
)
if alg.smooth
str = "The passed algorithm performs smoothing, but `dalton_nll` can be used without. " *
str =
"The passed algorithm performs smoothing, but `dalton_nll` can be used without. " *
"You might want to set `smooth=false` to imprpove performance."
@warn str
end
Expand Down

0 comments on commit 3f00f06

Please sign in to comment.