[ 
https://issues.apache.org/jira/browse/NUMBERS-156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17351014#comment-17351014
 ] 

Alex Herbert commented on NUMBERS-156:
--------------------------------------

Thanks for the update. It is curious that the sqrt2 cannot reduce the error to 
0 ulp. Did you ensure the sum and the roundoff were rebalanced to the 
non-overlapping split number (x, xx) before the call to sqrt2?

In this case it appears the extra overhead is not worth it for a marginal gain 
in precision (lower standard deviation). The {{extLinearSinglePass}} algorithm 
is a good choice. It just requires the scaling thresholds to be updated to 
handle extremely long input vectors. I think that optimising it for 2D and 3D 
can avoid using 3 individual sums with 3 compensations. It is easy to find the 
absolute maximum and minimum and then do the same scaling on all inputs as 
appropriate. No need to scale each differently. This is what the {{extLinear}} 
algorithm is doing (all input cloned and scaled with the same value) and in the 
results it has the same accuracy and precision as {{extLinearSinglePass}}.

Do you propose to add a 2D version for completeness or leave that to Math.hypot?

 

> SafeNorm 3D overload
> --------------------
>
>                 Key: NUMBERS-156
>                 URL: https://issues.apache.org/jira/browse/NUMBERS-156
>             Project: Commons Numbers
>          Issue Type: Improvement
>            Reporter: Matt Juntunen
>            Priority: Major
>         Attachments: performance-all.png, performance-len-1-5.png, 
> performance2-1-5.png, performance2-all.png, performance3-1-5.png, 
> performance3-all.png, performance4-1-5.png, performance4-all.png, 
> performance5-1-5.png, performance5-all.png
>
>
> We should create an overload of {{SafeNorm.value}} that accepts 3 arguments 
> to potentially improve performance for 3D vectors.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to