[
https://issues.apache.org/jira/browse/NUMBERS-156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17349742#comment-17349742
]
Alex Herbert commented on NUMBERS-156:
--------------------------------------
{quote}I ended up changing the c1, c2, c3 assignments in {{enormModExt}} from
"=" to "+=".
{quote}
Thanks for spotting that error. Either that to sum all the round-off together
or it should be added to y (this is what the Kahan method does).
{quote}for some reason both linear methods end up failing on some inputs on the
full input range.
{quote}
Failing as it computes NaN, inf or zero? I cannot see where this would happen
as the inputs should be sanitised to be non-NaN and below 2^500 in magnitude
and non-zero.
The threshold of 2^500 is incorrect for any length array and should be
adjusted. A full length input would be 2^31 numbers to sum as squares. So if
all numbers are 2^500 then we are summing 2^31 lots of 2^1000. This will
overflow. A better threshold would be half of 1023 - 31, so 2^496 or less. But
for length 100 input arrays we are summing less than 2^7 (128) lots of 2^1000.
This will not overflow 2^1023.
Can you save one of the offending input arrays and I can see what is happening.
There may be a bug in LinearCombination that requires fixing? Or something else
not obvious in the norm method.
An extended precision summation for the Manhatten norm would be easy to do
using a similar method to the Kahan summation or enormModExt. You just do not
require computing y as the square but instead using the absolute. All the
scaling is not required.
> 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
>
>
> 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)