[SciPy-Dev] QR-decomposition with Q but not Q

Nathaniel Smith njs@pobox....
Thu Aug 11 10:47:50 CDT 2011

On Thu, Aug 11, 2011 at 12:00 AM, Martin Teichmann
<martin.teichmann@lkb.ens.fr> wrote:
> Hi list,
> A QR decomposition is done in two steps: firstly,
> R is calculated and an intermediate form of Q
> (the so called "elementary reflectors"), and in a second
> step, Q is actually calculated.
> The second step, however, can be costly and
> thus is not done if you are not interested in Q. The
> QR decomposition code already allows for not
> calculating Q.
> Very often, however, one is interested in Q only in
> order to multiply it with a vector c. This can be done
> without ever calculating Q.

I made a comment there on an infelicity in the docs, but here are some
more general comments:

I was a little confused by your removing the scipy tril/triu
functions. Certainly they're redundant with the ones in numpy, but
does this have any consequences for compatibility? Do they need to be
deprecated for a cycle first?

Does the "economic" versus "full" distinction still make sense when
working with the reflectors? Because if so, then you should add a new
argument (like 'reflectors=True/False') instead of overloading the
mode= argument.

IIUC, the two options you add are (1) get out the elementary
reflections themselves, (2) get out the product of those elementary
reflections with some matrix c. Wouldn't it make more sense to have
just one option, for getting out the elementary reflections, and then
have a separate function that let you compute the product of some
elementary reflections with some matrix? It seems like you need that
anyway if anyone is to make any use of the elementary reflections from
option (1) -- and it allows more flexible use, like if you have lots
of c matrices that you need to multiply Q by -- but then once you have
such a function then option (2) is redundant and over-complicated.

-- Nathaniel

More information about the SciPy-Dev mailing list