Page 1 of 1

DGEEQU and DGELS

PostPosted: Sun Jan 28, 2007 1:05 am
by kdallen
Can DGEEQU be used to scale the matrix A in least squares problems? I can understand the use of DGEEQU for linear equations, but since M and N don't have to be equal, I presume it can be used in least squares problems. Trouble is, I can't get the math to make sense when solving A'As = A'b.

Thanks for your comments. This is a great forum. I've monitored it for months but never posted until now.

Ken

PostPosted: Mon Jan 29, 2007 9:00 am
by sven
Dear Ken,

The least squares problem is not invariant under row scaling, so you cannot use DGEEQU. You can, though, column scale the matrix as AD and then recover the least squares solution as s = Dy, where y is the solution of the scaled problem.

It can be a good idea to column scale so that the norm of each column is roughly equal in magnitude.

Best wishes,

Sven Hammarling.

PostPosted: Mon Jan 29, 2007 12:51 pm
by kdallen
Sven,

Thanks for your reply. I didn't know about row scaling.

I'm wondering, then, what DGEEQU can be used for when M and N are not equal. If not least squares, then what?

Ken

PostPosted: Mon Jan 29, 2007 4:34 pm
by sven
Dear Ken,

One can still perform an LU factorization of an m by n matrix when m is not equal to n, but of course the main use for DGEEQU is when m = n. When designing these routines we allowed for extra flexibility in case it was of use. Currently within LAPACK, DGEEQU is only used when m = n.

Best wishes,

Sven.

PostPosted: Mon Jan 29, 2007 4:43 pm
by sven
Jim Demmel reminded me that if you column scale A by powers of the radix,
(and ignoring over/underflow and Strassen-BLAS), then the roundoff errors from QR (without column pivoting) and subsequently solving the least squares problem are invariant? The scale factors don't affect Q, just scale the columns of R, and just "factor out" of the triangular solve.

But when solving the least squares problem with pivoting, or with any orthogonal transformation from the right, such as in the SVD, column scaling can be important. It could change the condition estimate arbitrarily, if the
columns are badly scaled, so that the scaled solution could have a much smaller normwise error bound than the unscaled solution.

We hope to include some advice in a future edition of the Users' Guide.

Jim and Sven.

PostPosted: Tue Jan 30, 2007 2:13 am
by kdallen
Thanks - very helpful information.

Ken