Open jwscook opened 3 years ago
The most straightforward answer is that you can't, they are immutable. And your gist doesn't try, despite its name changevalue!(x::Dual, ...
returns an altered dual, without changing its argument. And changevalue!(x::AbstractVector ...
writes what it returns into the (mutable) array x
. Which sounds fine.
See my gist for what I'm trying to achieve.
I'm using NLsolve to find the cartesian coordinates given curvilinear coordinates and a function that returns curvilinear coordinates given cartesian coordinates (the reciprocal function is not usually easy / possible to write down). I want to be able to perform multiple AD passes through the solver function as though I had written down the complicated forward transform. I hope that makes sense - the gist should help.
I can't think of a good way of manipulating the values inside a Dual to acheive the desired outcome. Is there a good way?