# Automatic differentiation of f(x) constructed by decomposition of a matrix M(x)

**URL:** <https://discourse.julialang.org/t/automatic-differentiation-of-f-x-constructed-by-decomposition-of-a-matrix-m-x/33061>\
**Category:** Optimization (Mathematical)\
**Tags:** differentiation, flux, machine-learning, numerics\
**Created:** [January 7, 2020, 12:54pm UTC](https://discourse.julialang.org/t/automatic-differentiation-of-f-x-constructed-by-decomposition-of-a-matrix-m-x/33061 "2020-01-07T12:54:04Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![juandarias](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juandarias/32/11486_2.png) [@juandarias](https://discourse.julialang.org/u/juandarias)\
**Post date:** [January 7, 2020, 4:15pm UTC](https://discourse.julialang.org/t/automatic-differentiation-of-f-x-constructed-by-decomposition-of-a-matrix-m-x/33061/4 "2020-01-07T16:15:03Z")

</div>

Thanks for the link @stevengj

> [@Native eigenvals for differentiable programming](https://discourse.julialang.org/t/native-eigenvals-for-differentiable-programming/27126/9):
>
> differentiating scalar functions of the eigenvectors is a bit more complicated but not too bad.

Long story short: My objective function `f(x::Vector)` is an error function of the form ||\textbf{J}\_T - \textbf{J}\_{exp}(x) ||, where \textbf{J}\_T is a target matrix and \textbf{J}\_{exp}(x) is a simulated matrix. The latter is calculated from the phonon modes (\vec b) and frequencies (\lambda) of certain 2D systems, i.e. J^{(m,n)}\_{exp}(x)= h(\vec b(x), \lambda(x)). To obtain \vec b(x), \lambda(x) I need to diagonalize some Hessian matrix \textbf{A}(x) describing the potentials of my system. So unfortunately it is not a more simple eigenvalue problem. I am not familiar with adjoint methods, so I would need to see if they could be applicable to my problem.

(I skipped the physical (fun!) details and whole expression of f(x) of my problem to keep it brief)

---

_[View the full topic](https://discourse.julialang.org/t/automatic-differentiation-of-f-x-constructed-by-decomposition-of-a-matrix-m-x/33061)._
