I have an array defined in MATLAB with dimensions 5×5×5×5, i.e., it is a 4-dimensional array. The numbers of this array define the values a function of 4 variables takes over some domain.
I need to compute the Hessian of this function. I need to compute it at every point in the array (ignoring corner cases, say). To do this, I take the function value at a point, compute the second differences and cross-partials across different dimensions. Then I create a determinant and examine its sign.
How to automate this process? That is, visit each point, and compute the determinant, using diff
function in MATLAB? Is there a defined procedure?