Make pivoting HouseholderQR compatible with custom scalar types
(transplanted from 6184cc070497ac5be2c7f081bce6d2280ee69e06)

--HG--
branch : 3.2
extra : transplant_source : a%84%CC%07%04%97%AC%5B%E2%C7%F0%81%BC%E6%D2%28%0E%E6%9E%06