cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Does genfit () speed depend on how the derivatives are forme

Ninetrees
12-Amethyst

Does genfit () speed depend on how the derivatives are forme

In the accompanying file, in M14.0.2.5, the call to genfit () takes much longer if I use the grad feature and stack () to build the derivative vector than if I figure the derivatives myself and build the vector. Does this have anything to do with my vector using calls to the original function, and if so, why does genfit () take so much longer using the grad method (recommended in Help)? See also the question about table formats. I can't figure how to make them look less clunky. File is submitted in M14 because I don't believe that the grad feature is in M11. ~Rich~
2 REPLIES 2
RichardJ
19-Tanzanite
(To:Ninetrees)

The additional time is due to two factors. One (the lesser one) is due to the fact that you have to rebuild the vector for every iteration of genfit, with multiple calls to stack. Stack takes a variable number of arguments, so you can call it only once, but this makes little difference (which surprises me a bit). Or you can build the vector by hand with the grad based derivatives. This does speed things up somewhat, but it is still much slower than using the symbolically derived derivatives. That's because grad evaluates the derivatives numerically; i.e. it's iterative. So every iteration of genfit requires the iterative evaluation of three derivatives, as opposed to the simple evaluation of three expressions. Rather than typing, or cut and pasting, the symbolic derivatives it's better to have the symbolic processor do the work. It avoids the possibility of typos. Richard
Ninetrees
12-Amethyst
(To:RichardJ)

Thanks, Richard, I thought that once the vector was built, there would be no rebuilding of it for each call to genfit (). I agree that letting the symbolic engine determine the derivatives is better than doing them by hand...that's how I go them in the first place. Then, to make the document a bit neater, I factored out the call to Gaussian ()...perhaps this should be noted in Mathcad Help, as the grad method is the recommended...I'll chat up Mona about it... I symbolically evaluated your f2 vector, and the timing for genfit () then agreed closely for f, f3, and f2s. No surprise, because the symbolic evaluation is exactly the same for f3 and f2s... ~R~
Announcements

Top Tags