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

provide option for symmetric scaling of strength #348

Open
lukeolson opened this issue Oct 6, 2022 · 1 comment
Open

provide option for symmetric scaling of strength #348

lukeolson opened this issue Oct 6, 2022 · 1 comment
Assignees

Comments

@lukeolson
Copy link
Member

If A is symmetric, then scale strength S symmetrically:

https://github.com/pyamg/pyamg/blob/main/pyamg/strength.py#L315

@jbschroder
Copy link
Member

jbschroder commented Oct 6, 2022

@lukeolson I think we do this in every strength measure, scale rows by largest entry, at the very end.

The question is how to "elegantly" extend this to scale symmetrically. For SA, rootnode, and the new CF_rootnode_solver in Carlo's branch, we always store the "symmetry" flag as A.symmetry. The Ruge-Stuben solver does not have a symmetry flag.

So, we could rename scale_rows_by_largest_entry(..) as symmetrically_scale_rows_by_largest_entry(..) and then do something like

D <-- largest entry in a row
D_inv = 1.0 / D  # be careful about zeros on diag
if hasattr(A, 'symmetry'):
  #scale symmetrically
  if symmetric or hermitian 
    new_A = scale_rows(A, np.sqrt(D_inv), copy=True)
    new_A = scale_columns(new_A, np.sqrt(D_inv), copy=False)
    return new_A 
    
#Do what we already do, and nonsymmetrically scale and return

Luckily, scale_rows_by_largest_entry(..) is only used by strength routines. So...I think we would need to update
strength.py :: call new symmetric function instead for scaling
util/utils.py :: redefine scale_rows_by_largest_entry as symmetrically_scale_rows_by_largest_entry
util/tests/test_utils.py :: update unit tests

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