I want to calculate the hessian of a matrix. So each element gets replaced by a 2 by 2 matrix.
hessian[im_, s_] :=
{{gD[im, 2, 0, 2], gD[im, 1, 1, 2]}, {gD[im, 1, 1, 2], gD[im, 0, 2, 2]}};
Now im = My matrix
.
I want to modify my hessian function in some way (using Map
) such that when I calculate the hessian of im
, 1 element at a time is calculated by gD
. At this time gD
works on the entire im
matrix.
How do I do this? Any help (preferable code) will be very helpful. I am new to Mathematica, struggling, and very frustrated.
gD
or a simple example with data might be helpful. Also this implementation may help you. Or are you just looking for something likehessian[im_, s_] := {{gD[#, 2, 0, 2], gD[#, 1, 1, 2]}, {gD[#, 1, 1, 2], gD[#, 0, 2, 2]}}&/@im;
$\endgroup$