| Language Reference |
applies complete orthogonal decomposition by Householder transformations on the right-hand-side matrix B for the solution of rank-deficient linear least squares systems
See the section "COMPORT Call" for information about complete orthogonal decomposition.
An example that uses the APPCORT subroutine follows:
/* Only four linearly independent columns */
A = {1 0 1 0 0,
1 0 0 1 0,
1 0 0 0 1,
0 1 1 0 0,
0 1 0 1 0,
0 1 0 0 1 };
/* compute Moore-Penrose generalized inverse */
b = i(nrow(A));
call appcort(Ainv,lindep,A,b);
print Ainv;
/* verify generalized inverse */
eps = 1e-12;
if any(A*Ainv*A-A > eps) |
any(Ainv*A*Ainv-Ainv > eps) |
any((A*Ainv)`-A*Ainv > eps) |
any((Ainv*A)`-Ainv*A > eps) then
print "Pseudoinverse conditions not satisfied";
else
print "Pseudoinverse conditions satisfied";
/* compute solution for rank deficient LS:
min |Ax-b|^2
The range of A is a line.
b is a point not on the line. */
A = { 1 2,
2 4,
-1 -2 };
b = {1, 3, -2};
call appcort(x,lindep,A,b);
print x;
AINV
0.2666667 0.2666667 0.2666667 -0.066667 -0.066667 -0.066667
-0.066667 -0.066667 -0.066667 0.2666667 0.2666667 0.2666667
0.4 -0.1 -0.1 0.4 -0.1 -0.1
-0.1 0.4 -0.1 -0.1 0.4 -0.1
-0.1 -0.1 0.4 -0.1 -0.1 0.4
Pseudoinverse conditions satisfied
X
0.3
0.6
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.