You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As discussed on the mailing list, I was working on a new vecnorm(x,p) function (generalizing and replacing normfro) which computes a p-norm of any iterable container as if it were a vector. I noticed that it is quite tricky to make it type stable, and that in fact our current norm function is not type-stable
Obviously, the "0-norm" needs to be promoted to a floating-point type. Similarly for the 1-norm of integer arrays.
(What's not as obvious to me is whether the norm of a Float32 array should be Float32. I'd much rather accumulate the sum in double precision, and I don't see the point of returning a single-precision result. However, since sum of a Float32 array is also single-precision, I suppose doing the same thing for norm makes a certain amount of sense.)
As discussed on the mailing list, I was working on a new
vecnorm(x,p)
function (generalizing and replacingnormfro
) which computes a p-norm of any iterable container as if it were a vector. I noticed that it is quite tricky to make it type stable, and that in fact our currentnorm
function is not type-stableObviously, the "0-norm" needs to be promoted to a floating-point type. Similarly for the 1-norm of integer arrays.
(What's not as obvious to me is whether the norm of a
Float32
array should beFloat32
. I'd much rather accumulate the sum in double precision, and I don't see the point of returning a single-precision result. However, sincesum
of aFloat32
array is also single-precision, I suppose doing the same thing fornorm
makes a certain amount of sense.)cc: @toivoh
The text was updated successfully, but these errors were encountered: