Skip to content

Commit

Permalink
Fix type instabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
albertomercurio committed Nov 18, 2024
1 parent 89b072c commit 892d0e9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
1 change: 0 additions & 1 deletion src/QuantumToolbox.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ import SciMLOperators:
IdentityOperator,
update_coefficients!,
concretize
import SciMLStructures: isscimlstructure, ismutablescimlstructure, hasportion, canonicalize, replace, replace!, Tunable
import LinearSolve: LinearProblem, SciMLLinearSolveAlgorithm, KrylovJL_MINRES, KrylovJL_GMRES
import DiffEqBase: get_tstops
import DiffEqCallbacks: PeriodicCallback, PresetTimeCallback, TerminateSteadyState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,6 @@ function _mcsolve_initialize_callbacks(cb::CallbackSet, tlist, traj_rng)
return CallbackSet(cb_continuous, (cb_jump, cb_save..., cb_discrete[3:end]...))
end
end
# _mcsolve_initialize_callbacks(cb::ContinuousCallback, tlist) = cb # It is only the continuous LindbladJump callback
# _mcsolve_initialize_callbacks(cb::DiscreteCallback, tlist) = cb # It is only the discrete LindbladJump callback
function _mcsolve_initialize_callbacks(cb::CBT, tlist, traj_rng) where {CBT<:Union{ContinuousCallback,DiscreteCallback}}
_jump_affect! = _similar_affect!(cb.affect!, traj_rng)
return _modify_field(cb, :affect!, _jump_affect!)
Expand Down Expand Up @@ -329,7 +327,7 @@ function _similar_affect!(affect::LindbladJump, traj_rng)
)
end

function _modify_field(obj::T, field_name::Symbol, field_val) where {T}
Base.@constprop :aggressive function _modify_field(obj::T, field_name::Symbol, field_val) where {T}
# Create a NamedTuple of fields, deepcopying only the selected ones
fields = (name != field_name ? (getfield(obj, name)) : field_val for name in fieldnames(T))
# Reconstruct the struct with the updated fields
Expand Down

0 comments on commit 892d0e9

Please sign in to comment.