Hi,
In the process of porting eigendecomposition-related routines from LAPACK to gonum I got to the entanglement of DLAQR{0,2,3,4}. It turns out that they are in fact only two unique routines. The algorithm at one point benefits from (just one level deep) recursion and since Fortran 77 does not include recursion, the authors expanded it explicitly by duplicating the two routines involved. As a result, DLAQR2 and DLAQR3 are almost indentical, and similarly DLAQR0 and DLAQR4 are almost identical.
My question is how to best port this to gonum. Some options that I see:
1. Port one routine from a pair, copy the code, make modifications, and in the future keep them in sync.
2. Port a pair (e.g., DLAQR2 and DLAQR3) as one unexported routine (func dlaqr23) that takes one extra bool parameter to indicate which path should be taken internally. This routine would be called by the implementation methods, something like:
func (impl Implementation) Dlaqr2(...) {
dlaqr23(..., true)
}
func (impl Implementation) Dlaqr3(...) {
dlaqr23(..., false)
}
func dlaqr23(..., useAsDlaqr2 bool) {
// ...
}
3. Similar to 2. but export and provide only func (impl Implementation) Dlaqr23().
4. Something else?
It is not a big design decision, once the routine is ported swapping between 1-4 is easy. I would go with 2 but I thought that I would ask what others think first.
V.