Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

square_norm question #60

Closed
kostrzewa opened this issue Feb 1, 2012 · 3 comments
Closed

square_norm question #60

kostrzewa opened this issue Feb 1, 2012 · 3 comments

Comments

@kostrzewa
Copy link
Member

I don't really understand what's going on in the linalg/square_norm function (at least the unoptimized one). It seems to me like there are four empty operations taking place.

At the third iteration of the loop we have:

tr = ds_3
ts = ds_1 + ds_2 + ds_3
tt = ds_3
ks = ds_1 + ds_2 + ds_3
kc = 0

Since all the variables are overwritten from one call to the next I presume they were declared static for performance purposes rather than data persistence, so I don't really know why the additions and subtractions are carried out and then discarded.

@deuzeman
Copy link

deuzeman commented Feb 1, 2012

Are you referring to the Kahan summation starting at line 75 of linalg/square_norm.c? Because I don't see anything getting directly discarded there...

@kostrzewa
Copy link
Member Author

I didn't know this had such a profound effect on numerical errors. Thanks.

@deuzeman
Copy link

deuzeman commented Feb 1, 2012

Neither did I, until I had the exact same reaction some time ago. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants