You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Matt Juntunen (Jira)" <ji...@apache.org> on 2021/04/28 14:33:00 UTC

[jira] [Commented] (NUMBERS-156) SafeNorm 3D overload

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

Matt Juntunen commented on NUMBERS-156:
---------------------------------------

[~aherbert], I have an implementation of this ready but the existing unit tests for {{SafeNorm}} are sparse and I'd like to expand them to verify the correctness of the new method. My idea was to create a vector generator that produces random double arrays, computes an exact norm using BigDecimal, computes a standard norm using double operations, and then compares these to the output of {{SafeNorm}}. My thought was that the {{SafeNorm}} output should be at least as close to the exact result as the directly computed norm. However, I'm running into issues getting an exact result, specifically with computing the square root of the sum of squares. I'm using Java 8 (which doesn't have BigDecimal.sqrt) so I've resorted to using Newton's method with mixed results. I feel like there's a much better way to do this. Do you have any ideas on how to approach these tests? Is my initial assumption that {{SafeNorm}} should be at least as close to the exact value as a standard computation correct?

> 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
>
> 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)