Skip to content

Computing specific columns of the Hessian matrix without computing the entire Hessian? #44

Answered by brianguenter
biona001 asked this question in Q&A
Discussion options

You must be logged in to vote

Some of your confusion may arise from the fundamentally different mechanisms ForwardDiff and FastDifferentiation use to evaluate derivatives. ForwardDiff is interpreting your Julia expression at run time. FastDifferentiation is compiling your symbolic derivative expression into an executable. Anything that is fixed at compile time will be a constant in the executable.

I didn't realize you wanted X to be a variable. You need to define a symbolic matrix Xsym = make_variables(:Xsym,n,p) and then create a runtime generated function that takes both β and X as arguments.

The function X_as_variable below should do what you want. You'll notice that the first time hess_func! is called it is relati…

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@brianguenter
Comment options

Answer selected by biona001
@biona001
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants