ginkgo
ginkgo copied to clipboard
ScaledReordered interface
This PR adds an interface for wrapping an inner operator (like a direct or iterative solver) into a (for now symmetrical, e.g. RCM) reordering via a reordering factory and diagonal scaling via one row and one column scaling diagonal matrix.
The ScaledReordered
LinOp applies the given scaling and reordering to the system matrix and generates the inner operator on the modified problem. It manages three vectors, a right-hand side and a solution vector for the inner operator, and an intermediate vector used for the permutations.
With a permutation matrix P
, a row scaling matrix R
, and a column matrix C
, the system matrix and vectors are scaled and permuted such that instead of the original system of equations
A*x = b
the inner operator solves
P*R*A*C*P^T*y = P*R*b
.
Hence, when generating a ScaledReordered
LinOp, the new system matrix P*R*A*C*P^T
is computed. When it is applied to vectors b
and x
, the right-hand side vector is modified to P*R*b
, and the solution y
to the inner system gives the solution x
to the original system via x = C*P^T*y
.
When using an inner operator that uses an initial guess, currently the initial guess for the inner system is computed by y_0 = P*C^(-1)*x_0
, which is the same as using x_0
for the system P*R*A*x = P*R*b
. For the inverse diagonal scaling here I added an inverse_apply
to the matrix::Diagonal
. I still need to add tests for that.
Any feedback is welcome, especially on ideas regarding how to handle algorithms like RCM that generate a reordering, but also be able to handle MC64 that generates both a reordering and scaling coefficients and simpler equilibration techniques that only generate scaling coefficients.
format!
format!
Note: This PR changes the Ginkgo ABI:
Functions changes summary: 4 Removed, 32 Changed (439 filtered out), 1246 Added functions
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
For details check the full ABI diff under Artifacts here
AFAIR, combing scaled and reordered together allows some algorithms uses only one operation. how do you do that when a new LinOp?
AFAIR, combing scaled and reordered together allows some algorithms uses only one operation. how do you do that when a new LinOp?
At the moment, not at all. So far the operations are not merged yet.
will the merged operations be in this class or another class inherited from this class? if there's another class, the clone will only give the clone of ScaledReordered class not itself.
format!
Depends on #1171 now.
Ready to merge after #1171
Note: This PR changes the Ginkgo ABI:
Functions changes summary: 166 Removed, 168 Changed (256 filtered out), 1445 Added functions
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
For details check the full ABI diff under Artifacts here