## DGEEQU and DGELS

Open discussion regarding features, bugs, issues, vendors, etc.

### DGEEQU and DGELS

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
kdallen

Posts: 39
Joined: Sun Jan 28, 2007 12:48 am

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.
sven

Posts: 146
Joined: Wed Dec 22, 2004 4:28 am

Sven,

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

Ken
kdallen

Posts: 39
Joined: Sun Jan 28, 2007 12:48 am

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.
sven

Posts: 146
Joined: Wed Dec 22, 2004 4:28 am

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.
sven

Posts: 146
Joined: Wed Dec 22, 2004 4:28 am