Skip to content

Commit

Permalink
Made function for easily getting single control value with respect to…
Browse files Browse the repository at this point in the history
… the global control vector
  • Loading branch information
leespen1 committed Mar 27, 2024
1 parent 168e2c8 commit 003fe83
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Controls/Control.jl
Original file line number Diff line number Diff line change
Expand Up @@ -243,3 +243,19 @@ Return the index of the region to which `t` belongs.

return region_index
end

"""
Given a set of controls and the control vector for all of them, evaluate a
single control on its portion of the control_vector
"""
function eval_p_single(controls, t, pcof, control_index)
local_control = controls[control_index]
local_pcof = get_control_vector_slice(pcof, controls, control_index)
return eval_p(local_control, t, local_pcof)
end

function eval_q_single(controls, t, pcof, control_index)
local_control = controls[control_index]
local_pcof = get_control_vector_slice(pcof, controls, control_index)
return eval_q(local_control, t, local_pcof)
end
1 change: 1 addition & 0 deletions src/QuantumGateDesign.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,6 @@ export convert_to_numpy, Qobj, unpack_Qobj, simulate_prob_no_control
export get_number_of_control_parameters
export multi_qudit_hamiltonian
export control_ops
export eval_p_single, eval_q_single

end # module QuantumGateDesign

0 comments on commit 003fe83

Please sign in to comment.