[MATLAB] Compute eigenvalues' Jacobian via callback

75 views
Skip to first unread message

Filippo Trevisi

unread,
Mar 29, 2023, 11:43:51 AM3/29/23
to CasADi
Dear all,

I want to provide the analytical Jacobian of the eigenvalues D of a matrix A via callbacks (in particular I am interested in the damping ratios to be used within an optimization).  
Please find a minimal code at <script src="https://gist.github.com/fitr44/01236099ec9b4474d9228ae6300a8f43.js"></script>
When running the code, I get the following error: 
err1.png
In alternative, by typing "jac = jacobian(g,x);", I get the following error: err2.png
Note that, in the eval method of the jacobian, I commented my implementation to make sure the outputs is of the correct shape. 

Any help on resolving this errors? I would be extremely grateful.

PS. the derivatives of the eigenvalues can be obtained if the derivative of A and the eigenvalues themselves are known (they can be evaluated numerically only once). This problem seems relevant also to others. 

Thanks in advance, 
Filippo

Filippo Trevisi

unread,
Mar 29, 2023, 11:46:46 AM3/29/23
to CasADi
Sorry, I just realized the link to the minimal code does not work. This should work: https://gist.github.com/fitr44/01236099ec9b4474d9228ae6300a8f43
Reply all
Reply to author
Forward
0 new messages