From help-request at octave dot org Fri Jan 7 20:22:23 2005 Subject: Re: 'economy size' qr ? From: Johan Kullstam To: help at octave dot org Date: 07 Jan 2005 21:24:20 -0500 "Pascal A. Dupuis" writes: > Hello, > > I would like to solve a overdetermined set of equation Ax=B, where > A is C m x n > x is R n x 1 > B is C m x 1 > > In order for x to be real, the problem is augmented as: > > [ A; conj(A) ] x = [b; conj(b)] > > The first step is to compute > [qq, qr] =qr([A , b; conj(A) conj(b)]); Why not make AA = [real(A); imag(A)] BB = [real(B); imag(B)] and solve the least squares for AA being 2*m by n BB being 2*m by 1 and the same x as above? The complex nature of A and B but having x be real just makes it a twice as large problem in the reals, but hidden by the notation. > qr is a n+1 x n+1 upper real triangular matrix > > then the resolution is performed using various approaches on qr. > > Given that > 1) qq is not needed (2m x 2m complex matrix !) You would have a 2*m by 2*m Q matrix with the real formulation but it would at least be real valued. There is an economy QR where Q is truncated to the span dimensions of A and R is square -- just add a 2nd argument of 0 like SVD takes. Unfortunately, the "help qr" doesn't mention this (perhaps this is a documentation bug?). [qq, rr, pp] = qr(AA,0) now qq is the same dimensions as AA which is savings. > 2) although A and b are complex, qr is real > > are there simpler approaches in order to obtain qr, skipping the qq > computation ? You have 2*m real constraints and n real unknowns. Putting it in a complex format doesn't change that and, in fact, seems to be a hindrance in matrix size economy. > Thanks in advance Hope this helps. -- Johan KULLSTAM ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------