-
Hello, I have a Csr matrix which never changes (filled at initialization), and I have a function which solves a linear problems (using BiCGStab) for a given right hand side. I also have another function which solves the transpose problem. What is the best strategy?
The underlying question is: is transposition costfull and does it require a copy matrix and transposition into it, or does it change the "direction" of the computations performed by the solver ? Looking in the code I think this is the first option but I want to be sure. Regards |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Definitely store both the matrix and its transpose explicitly, transposition is not cheap (something in the order of sorting the nonzero entries by row and column index, since the sparsity pattern of the matrix and its transpose need not be identical, and values need to be shuffled), all of our matrices are processed in row major order only, since that is more efficient for parallel processing than column major. You can save some work by (assuming you use a preconditioned solver) computing the preconditioner exactly and transposing the result only, passing the generated preconditioner to the solver instead of a preconditioner factory. Especially for preconditioners like ILU or ISAI, the generation is significantly more costly than a simple transposition. |
Beta Was this translation helpful? Give feedback.
Definitely store both the matrix and its transpose explicitly, transposition is not cheap (something in the order of sorting the nonzero entries by row and column index, since the sparsity pattern of the matrix and its transpose need not be identical, and values need to be shuffled), all of our matrices are processed in row major order only, since that is more efficient for parallel processing than column major.
You can save some work by (assuming you use a preconditioned solver) computing the preconditioner exactly and transposing the result only, passing the generated preconditioner to the solver instead of a preconditioner factory. Especially for preconditioners like ILU or ISAI, the g…