Skip to content

Commit

Permalink
Fix some bugs and renames I just introduced
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanaelbosch committed Oct 23, 2023
1 parent 26a0f6f commit 1bf97dc
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/caches.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ function OrdinaryDiffEq.alg_cache(
d = is_secondorder_ode ? length(u[1, :]) : length(u)
D = d * (q + 1)

FAC = get_covariance_factorization(alg)
if FAC isa KroneckerCovariance && !(f.mass_matrix isa UniformScaling)
FAC = get_covariance_structure(alg)
if FAC isa IsometricKroneckerCovariance && !(f.mass_matrix isa UniformScaling)
error(
"The selected algorithm uses an efficient Kronecker-factorized implementation which is incompatible with the provided mass matrix. Try using the `EK1` instead.",
)
Expand Down
2 changes: 1 addition & 1 deletion src/covariance_structure.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function get_covariance_structure(alg)
) &&
alg.prior isa IWP
)
return IsometrciKroneckerCovariance()
return IsometricKroneckerCovariance()
else
return DenseCovariance()
end
Expand Down
2 changes: 1 addition & 1 deletion src/kronecker.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
@doc raw"""
IsometricKroneckerProduct(left_factor_dim::Int64, right_factor::AbstractMatrix)
Kronecker product of an identity and a generic matrix:
Expand Down
2 changes: 1 addition & 1 deletion src/priors/common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function initialize_transition_matrices(
return A, Q, Ah, Qh, P, PI
end
function initialize_transition_matrices(
fac::CovarianceFactorization,
fac::CovarianceStructure,
p::AbstractODEFilterPrior,
dt,
)
Expand Down
9 changes: 7 additions & 2 deletions src/priors/iwp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,20 @@ function discretize(p::IWP, dt::Real)
return A, Q
end

function initialize_transition_matrices(::KroneckerCovariance, p::IWP{T}, dt) where {T}
function initialize_transition_matrices(
::IsometricKroneckerCovariance,
p::IWP{T},
dt,
) where {T}
A, Q = preconditioned_discretize(p)
P, PI = initialize_preconditioner(p, dt)
Ah = PI * A * P
Qh = PSDMatrix(Q.R * PI)
return A, Q, Ah, Qh, P, PI
end
function initialize_transition_matrices(::DenseCovariance, p::IWP{T}, dt) where {T}
A, Q, Ah, Qh, P, PI = initialize_transition_matrices(KroneckerCovariance(), p, dt)
A, Q, Ah, Qh, P, PI =
initialize_transition_matrices(IsometricKroneckerCovariance(), p, dt)
P, PI = Diagonal(P), Diagonal(PI)
A, Q, Ah, Qh = Matrix(A), PSDMatrix(Matrix(Q.R)), Matrix(Ah), PSDMatrix(Matrix(Qh.R))
return A, Q, Ah, Qh, P, PI
Expand Down
2 changes: 1 addition & 1 deletion src/projection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function projection(
end

function projection(
::KroneckerCovariance,
::IsometricKroneckerCovariance,
d::Integer,
q::Integer,
::Type{elType}=typeof(1.0),
Expand Down

0 comments on commit 1bf97dc

Please sign in to comment.