using different form of cost function instead of fidelity #99
-
Hi, I have been wondering if I can use krotov to optimize different forms of cost function, other than fidelity. Additionally, suppose we have some random operator A. Then is it possible to minimize the trace distance between the two density operators mutilplied by this operator A: i.e. trace(A(rho_target - rho_ansatz)). Does this also feasible via krotov? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 19 replies
-
Of course! |
Beta Was this translation helpful? Give feedback.
-
The answer to your second question is also, yes. This would simply be the optimization of an expectation value difference which is one of the standard optimization tasks. |
Beta Was this translation helpful? Give feedback.
-
Thank you so much for your response! I read through the example, it helped me a lot. How can I customize (or build) my own cost function that goes into I'd really appreciate it if you can help me out with this :) |
Beta Was this translation helpful? Give feedback.
-
From a technical perspective, the only thing required for a new functional is to define a function that evaluates I would also point out that If you find the matrix calculus notation unsettling, |
Beta Was this translation helpful? Give feedback.
From a technical perspective, the only thing required for a new functional is to define a function that evaluates
∂J/∂⟨ϕₖ|
and that you can pass aschi_constructor
to theoptimize_pulses
routine, as outlined in the documentation ofkrotov.functionals
.I would also point out that
J_T_hs
/chis_hs
is already defined and should cover your first case. For the second case of the expectation value, you'll have to write your own function, but it should be fairly straightforward to calculate the χ-states exactly analogous to the calculation shown in thechis_hs
docstring.If you find the matrix calculus notation unsettling,
∂J/∂⟨ϕₖ|
is just shorthand for a Wirtinger derivative, but calculating it…