ginkgo-project / ginkgo

Numerical linear algebra software package
https://ginkgo-project.github.io/
BSD 3-Clause "New" or "Revised" License
401 stars 88 forks source link

Add scaling for batch objects #1527

Closed pratikvn closed 8 months ago

pratikvn commented 8 months ago

This PR pulls out a part of functionality from #1458 to ease the review process. It mainly adds scaling (row and column) for batched matrices and multi-vectors, which is useful in many applications, particularly SUNDIALS and XGC.

sonarcloud[bot] commented 8 months ago

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

32 New issues
0 Security Hotspots
59.6% Coverage on New Code
19.4% Duplication on New Code

See analysis details on SonarCloud

pratikvn commented 8 months ago

@MarcelKoch and @yhmtsai, I decided to make scale a member function and remove the functionality from the solver entirely. After re-thinking this, I think there is no need to have it within the solver as it only brings complications and it would be a separate kernel anyways, so no real performance optimizations are possible. I think this approach should be much cleaner. The user now decides if they want to scale the matrix and do it before hand. Maybe adding a inverse_scale for the batched MultiVector makes sense.

pratikvn commented 8 months ago

I somehow miscalculated the scaling apply. I now changed the user-facing parameter order to (row_scale, col_scale).