[eigen] Dense Matrix Decompositions/Solvers: Inherit from SolverBase

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Good day,

as this is my first entry to this mailing list, I would like to shortly introduce myself. My name is Patrick Peltzer and I'm a Computational Engineering Science student at RWTH Aachen, Germany. I'm currently working on my Bachelor thesis with the title "Efficient Adjoints of the Linear Algebra Library Eigen using dco/c++", in which I'm creating a fork of Eigen to optimize its usage with the algorithmic differentiation software dco/c++. Amongst other things, I'm implementing symbolic solver versions of the Eigen build-in solvers. Symbolic solvers allow to reuse the already computed matrix decomposition when doing the reverse part of algorithmic differentiation, saving memory and speed by making the recording of the decomposition calculation and the recalculation obsolete. If you are interested, you can find more info here: https://www.stce.rwth-aachen.de/research/publications/naumann2012dls

For these symbolic solvers, I've created a parent class which inherits from SolverBase. The symbolic solver variants for FullPivLU and PartialPivLU inherit from my parent class and they work like a charm. However, I would like to include the other solvers listed here https://eigen.tuxfamily.org/dox/group__TutorialLinearAlgebra.html, e.g. HouseholderQR. However, all these other decompositions do not inherit from SolverBase. My questions is: Is there a reason why?

From the documentation I can see that all SolverBase subclasses must have the same interface as shown here https://eigen.tuxfamily.org/dox/classEigen_1_1SolverBase.html. Now, it appears that only the transpose/adjoint solve implementation are missing from the other decompositions. Is this the only reason why they do not inherit from SolverBase? And if so, would it be desirable to implement them?

So far I have only looked at the HouseholderQR class, but changing it to inherit from SolverBase appeared relatively easy by adding the trait struct and the _solve_transposed implementation:


template<typename _MatrixType>
template<typename RhsType, typename DstType>
void HouseholderQR<_MatrixType>::_solve_impl_transposed(const RhsType &rhs, DstType &dst) const
{
  const Index rank = (std::min)(rows(), cols());
  eigen_assert(rhs.rows() == rows());

  dst = householderSequence(m_qr.leftCols(rank),m_hCoeffs.head(rank)) * m_qr.topLeftCorner(rank, rank).template triangularView<Upper>().transpose().solve(rhs.topRows(rank));
}


I have only tested the above implementation for quadratic, real matrices, so it might still need some changes. But it appears to me that inheriting from SolverBase didn't break any other feature, as the qr test still succeeds. So, can this be seen more like a feature request to provide all the missing _solve_transposed implementations, or is there anything else I'm missing out?


Best regards,

Patrick Peltzer





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/