Draft: Add abbreviations for TriangularViews and SelfadjointViews.

Reference issue

What does this implement/fix?

Having had to type out template triangularView<Eigen::Lower> once too often I decided to do something about it. This adds abbreviations lowerTriangularView, upperTriangularView, strictlyUpperTriangularView, strictlyLowerTriangularView, unitUpperTriangularView, and unitLowerTriangularView for template triangularView<Eigen::Lower> etc. These abbreviations can be called without the template keyword. Also namespace identifiers aren't necessary, so they save a lot of typing. While I was at it, I added similar abbreviations for selfadjointView (only for Lower and Upper, though).

This is not ready for inclusion as it lacks the necessary updates to the documentation, but since this is such an obvious (to me) enhancement, I wanted to confirm that the maintainers are not against this for reasons that I cannot fathom. I mean, instead of these abbreviations we have a whole page of documentation devoted to the template keyword.

In order to further reduce the necessity for template keywords, I'd also suggest to do this for solve and solveInPlace, but again, I wanted buy-in first.

Additional information

In order to get good test coverage cheaply, I decided to replace almost all tests that use template triangularView and template selfadjointView with the abbreviations, but keep the unabbreviated version in cases where the template keyword is not used. This way a vast number of tests for either variation are present in the testsuite.

One remark about naming: it may at first seem odd to have upper, lower etc in front of the method names, but I decided to do it that way because it's more grammatical to have the adjective in front. We (or I at least) are just so used to have Lower etc follow the function name because the C++ grammar forces us to do it this way if we want to use template arguments.

Another remark: for people using MSVC this makes cross-platform development significantly easier. Even with the /permissive- flag which makes MSVC accept a language somewhat resembling C++ instead of whatever it accepts by default, this compiler doesn't require template in all places where the language demands it, and so I always end up having to add a few here and there when moving to a different machine.

Edited by Tobias Schlüter

Merge request reports

Loading