[LINEAR SOLVERS] Add multi-RHS Solve(A, X, B) implementation and tests for Eigen-based direct linear solvers#14263
Open
juancamarotti wants to merge 2 commits intomasterfrom
Conversation
Added tests for Eigen direct solvers with matrix RHS.
Member
|
@RiccardoRossi nice |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds support for solving linear systems with multiple right-hand sides in the Eigen-based direct linear solvers by implementing the interface
Solve(A, X, B)where
Bis a dense matrix containing several RHS vectors andXis the corresponding solution matrix.Previously, the test suite only verified the vector version of the interface:
Solve(A, x, b)while the matrix-RHS overload was not covered by tests. This PR implements the multi-RHS solve by looping over the columns of
B, solving each system, and storing the corresponding solution in the columns ofX.In addition, new tests are introduced to verify the correct behavior of this interface. The tests reuse the existing MatrixMarket test matrix (
A.mm) already used in the current solver tests.Motivation
Some applications require solving linear systems with several RHS while the LHS does not change. This interface allows reusing the same solver infrastructure for such cases while keeping compatibility with the existing vector-based API.
Changes
Solve(A, X, B)interface for Eigen-based linear solvers.Tests added
The following tests were added:
test_EigenSparseLU_MatrixRHStest_EigenSparseQR_MatrixRHStest_EigenPardisoLU_MatrixRHStest_EigenPardisoLDLT_MatrixRHSThese tests solve a system with multiple RHS and verify the result by checking that
A * Xreproduces the original matrixB.Tests for MKL-based solvers (
Pardiso) are conditionally executed depending on whether Kratos was compiled with MKL support, following the existing pattern in the test suite.