Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geodesic Acceleration 3D function #235

Open
cdelv opened this issue Apr 8, 2023 · 0 comments
Open

Geodesic Acceleration 3D function #235

cdelv opened this issue Apr 8, 2023 · 0 comments

Comments

@cdelv
Copy link

cdelv commented Apr 8, 2023

Hi, I want to use geodesic acceleration for a 3D function. Actually, it's a special case of a 2D Gaussian:

function twoD_Gaussian(xyz, p)
    x = xyz[:, 1]
    y = xyz[:, 2]
    z = xyz[:, 3]
    amplitude, x0, y0, sigma2 = p
    g = @. amplitude * exp(-0.5*(((x - x0))^2/sigma2 + ((sqrt(y^2 + z^2) - y0))^2/sigma2 ))
    return g[:]
end

However, following the example of the README using Zygot I haven't been able to make it work. This is the best of my attempts

    function Avv!(dir_deriv,p,v)
        for i=1:length(xyz)
            X = xyz[i,:]
            dir_deriv[i] = transpose(v) * Zygote.hessian(z->twoD_Gaussian(X[:,:]',z),p) * v
        end
        return nothing
    end

Can you tell me how to do it for multidimensional functions?

Best regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant