Hotfix: 'Vector.__rtruediv__' and 'L2Clipping'
This MR is about hotfixing two (linked) math errors:
-
Vector.__rtruediv__
was badly implemented.- Hence
float / vector
would result invector / float
, which is the inverse of what we want.
- Hence
-
L2Clipping
did not properly implement the desired clipping algorithm.- Instead of clipping above-norm-threshold parameters to the desired maximum norm value, the current implementation scales down further low the below-threshold ones.
Both points were easy to patch, but have been in our code base in previous releases...
The first point is global, but has (hopefully) had little consequence in practice, since it was seemingly unused until now (and is being used as part of the corrected L2Clipping
).
The second point is an issue. This hotfix will be backported to previous versions of declearn, as a subminor version patch, in an effort to mitigate the impact on (future) end-users.
The first point shows that the current Vector
unit tests are insufficient; I am opening an issue to enhance them soon. The second would be harder to spot via a test (unless writing up a couple of dummy cases, which is not a very clever approach but could be done rather easily).