Dear Sebastian!
Thank you for the greate tool! I am new to it and have a question. Is it possible to compute (algopy) Jacobian of (algopy) gradient? I mean I have to compute something like:
def pot(u):
"""
pot is scalar
"""
return u[0]**2 + u[1]**2 + u[2]**2
# Works fine, computes gradient of pot
def stress(u):
"""
Returns vector with 3 components
"""
u = algopy.UTPM.init_jacobian(u)
stress = algopy.UTPM.extract_jacobian(pot(u))
return stress
# Works fine, returns vector with, e.g., 5 components
def flux(u):
""" """
f = algopy.zeros((5,), dtype=u)
s = stress(u)
# Some non-trivial dependence of f on u
f[0] = s[0]*s[0]
f[1] = s[1]*s[1]
f[2] = s[2]*s[2]
f[3] = s[0]*s[1]
f[4] = s[1]*s[2]
return f
# Need to compute jacobian of flux w.r.t. u, which is 5 by 3 matrix
# ???
I went through documentation and examples but have not managed to find solution (although I think
https://pythonhosted.org/algopy/examples/comparison_forward_reverse_mode.html is the most closed example for the problem)
Many thanks in advance!
Evgeny