Thanks albanD! That makes sense in the case when g0 is of length equal to the length of b. Do you know what happens when g0 is of length 1 and why is a.grad of length 1 then?
It is a bit of a shame that this isn’t written in the official documentation. A formula is worth a thousand words!