pgesvx
The pgesvx solver supports the following input types.
- data type: DSZC
- index type:
std::int32_t,std::int64_t
The pgesvx solves a square matrix using LU decomposition with partial pivoting.
The matrix of size \(N\) is stored in a memory block of size \(N^2\).
The solver can apply equilibration and iterative refinement.
This is an expert solver.
Constructor
There are four template arguments.
- data type, e.g.,
double,float,std::complex<double>,std::complex<float>. - index type, e.g.,
std::int32_t,std::int64_t. - equilibration flag,
F,N,E. - proccess grid order,
RorC.
This solver uses a 2D process grid, so one can choose from Row major or Column major ordering.
With np_row and np_col denoting the numbers of rows and columns of the process grid, a solver can be constructed using the following.
It is possible to let the library automatically determine the numbers of rows and columns, then the solver can be constructed as
Solving
Prepare matrices \(A\) and \(B\) on the root process in whatever form of choice.
Those two matrices need to be wrapped into template<data_t DT, index_t IT> struct full_mat objects, which require
- the number of rows of the matrix,
n_rows, - the number of columns of the matrix,
n_cols, - a pointer pointing to the data,
data.
Then one can call the solver via
The factorization cannnot be reused.
Thus, every call to solve(full_mat<DT, IT>&& A, full_mat<DT, IT>&& B) will invalidate the previous factorization and perform the factorization again even if the matrix \(A\) does not change.
This is a costly solver, if pgesv suffices, pgesvx shall only be used in advanced cases.
On return, B will be replaced by the solution.
In the above example, std::vector<double> B will contain the solution.