JuliaLinearAlgebra / AlgebraicMultigrid.jl

Algebraic Multigrid in Julia
Other
117 stars 23 forks source link

Symmetric strength: should not scale cols before taking abs of values #39

Closed mohamed82008 closed 6 years ago

mohamed82008 commented 6 years ago

https://github.com/JuliaLinearAlgebra/AlgebraicMultigrid.jl/blob/061a5418f04ffac9eeac4566ec00d378bdf1cf72/src/strength.jl#L125

I couldn't find any support from literature as to why the column scaling by maximum (positive) value in the column is done before taking the absolute value. Did I miss something or is this a bug? It would be the same if the largest entry by magnitude in each column was a positive one anyways. But if one negative entry has a high magnitude, then the resulting strength matrix will have some strength entries > 1. This is also inconsistent with the Classical strength calculation function that takes abs value before scaling. Swapping the 2 did not change my test results. If you approve this change, I will make a PR next.

mohamed82008 commented 6 years ago

This also is inconsistent with the PyAMG package https://github.com/pyamg/pyamg/blob/17bf583bd6fd4943131ac4939ce8eeae6265ffb1/pyamg/strength.py#L325 that takes abs value first. PR coming.

ranjanan commented 6 years ago

Yes, I think this may be a bug. PR is welcome.