Same code, very different results with Julia 1.4.2 and Julia 1.5.2

Would it be feasible from a store perspective to sort the list before taking the norm? If so, that should fix the problem.

1 Like

Yes. I will try!

I just did some reading, and while my previous solution works, there is a much better one. Divide the array by the maximal element before taking the norm. Then multiply the result by the maximal element. This re-normalization prevents any possibility of overflow. (For very badly conditioned data, sorting may still be necessary though).

2 Likes

I am closing this thread. After all, the numerical error associated to large differences in some terms was indeed happening, as well as the strange difference in Julia’s version and CPU.

But the final culprit was a very silly mistake: There is a term like:

v^T * M * u

where u and v are complex vectors and M a complex matrix. This operation was implemented as dot(v,M,u) but this corresponds to

v^H * M * u

in Julia (and I do agree with this). This term is usually zero, but in some very rare circumstances it was being (wrongly) computed.

Thank you again for all your help and tips. I learned a lot in this process.

7 Likes