Transpose and adjoint solve capabilities for SparseLU
The changes add support for transpose and adjoint solves to SparseLU. Given a sparse matrix A and a right-hand side vector b, additionally to solving A x1 = b, now it is also possible to reuse the factorization of A to also solve the adjoint problem A' x2 = b and the transposed problem A^T x3 = b. An example code is:
VectorXd x1(n), x2(n), x3(n), b(n);
SparseMatrix<double> A;
SparseLU<SparseMatrix<double>, COLAMDOrdering<int> > solver;
// fill A and b;
// Compute the ordering permutation vector from the structural pattern of A
solver.analyzePattern(A);
// Compute the numerical factorization
solver.factorize(A);
//Use the factors to solve the linear system, the adjoint system and the transposed system
x1 = solver.solve(b);
x2 = solver.adjoint().solve(b);
x3 = solver.transpose().solve(b);
The affected files are
Eigen/src/SparseLU/SparseLu.h: providing functionality and documentation for the new member functions adjoint() and transpose(). To this and the two member variables m_transposeView and m_adjointView are added, that increase the size of of a SparseLU instance by a few bytes.
Eigen/src/SparseLU/SparseLU_SupernodelMatrix.h: Add member function solveTransposedInPlace() for adjoint and transpose solve and related code.
test/sparse_solver.h: Tests of the new member functions are added in a form of template function specialization of check_sparse_solving().
I hope that the changes are helpful to some users. I am eager for comments and also willing to improve the code/documentation.