Am 27.10.2023 um 16:08 schrieb Cottrell, Allin:
On Fri, Oct 27, 2023 at 2:48 AM Riccardo (Jack) Lucchetti
<p002264@staff.univpm.it> wrote:
Call b the parameter vector and g the gradient vector, both with n
elements. Then the norm is computed as

gradnorm = sqrt(abs(b'g)/n)

I don't remember where this formula came from, Allin and I worked on
this piece of code long ago.
The gradient norm code was added to gretl_bfgs.c on 2010-01-26. I
presume there must have been some email discussion at the time but I'm
afraid I can't find it.

[moving my reply to the devel list, without implying that other replies need to do the same]

I'll exploit this trigger to say that this is an example why I've repeatedly said that the gretl source could always use more comments.

At the same time, I'm happy to admit that I think the situation has gotten better since 2010.

As for the formula --and without having looked at the code or anything else-- isn't it a bit surprising that the parameter and its gradient are multiplied? I mean, wouldn't you expect a kind of normalized or scaled gradient, perhaps something like abs(g'(1./b)) or so? But again, maybe I'm totally missing the context and this is a stupid remark.

cheers

sven