4

I am reading an iteration method for computing the Moore- Penrose genralized inverse of a given matrix $A$, which is given as follows:

$X_{k+1} = (1+\beta)X_{k} - \beta X_{k} A X_{k}$

where $X_{k}$, k = 0,1,... is a sequence of approximations for computing Moore- Penrose genralized inverse

$ X_{0} = \beta A' $ is the initial approximation , $0<\beta\leq 1$ and $A'$ is the transpose of matrix $A$

$d_{k} = \|X_{k+1} - X_{k}\|_{fro}$ is the error matrix norm (frobenius norm)

I have made following matlab program for computing Moore- Penrose genralized inverse by above mentioned method. But i am unable to make code for stopping criterion which says that.

perform the iteration untill

$|d_{k+1}/d_{k} - \beta -1|> 10^{-4}$

enter image description here

Please help me with this. I would be very much thankful to you.

Srijan
  • 12,518
  • 10
  • 73
  • 115

1 Answers1

3

The prep before your loop should stay the same. The appropriate script is

A = ...; % as you have given
beta = ...; % whatever you want
X0 = beta*A'; % calculate initial estimate

% (these initial values may need to be changed, I don't have a copy of
%    matlab in front of me)    
dklast = NaN; dk = NaN; % initialise to begin loop

iter = 0;
maxiter = 100;

while (abs(dk/dklast - beta - 1) > 1e-4) && (iter < maxiter) % loop until tolerance met
    iter = iter + 1; % keep count of iteration

    X1 = (1+beta)*X0 -beta*X0*A*X0; % calculate new iterate

    dklast = dk; % move old difference "new estimate to previous iterate"
    dk = norm(X1-X0,'fro'); % determine new difference 

    X0 = X1; % copy current iterate to "old" iterate for next iteration

end

I am wondering why you are using this convergence test at all. I would recommend using

dk = norm(X1*X0-I,'fro');

which measures how close X1 is to the left inverse of $A$. Your termination criteria would then be

while dk > (some_tolerance) && iter < maxiter
    ....
end

As you currently have, you are measuring how much X1 changes from X0, which may be small, but still not an approximate inverse (or pseudoinverse) for $A$.

Daryl
  • 5,598
  • First of all thanks for replying me. I took beta = 1/norm (A,2)^2 , but program is not running. – Srijan Sep 14 '12 at 08:58
  • What error are you receiving? I have seen this algorithm with beta=1, not anything else. As I said, those two lines may need to be changes. You could initialise the process with dklast=-30 and dk=-20 and it should work then. – Daryl Sep 14 '12 at 10:05
  • Programm is not running..just Matrix A is coming...not getting x1.. – Srijan Sep 14 '12 at 10:07
  • If X1 is not defined at the end of the iteration, then the loop is not running. As I said in my above comment, try with the values I have given there. The NaN terms may be invalidating the condition. – Daryl Sep 14 '12 at 10:10
  • Dear i am not getting what you mean by x1 is not defined at the end of iteration bro..x1 is the sequence of approximation..nd you have defined that – Srijan Sep 14 '12 at 10:13
  • X1 is your current approximation for the inverse. If it is not defined in the matlab workspace, then the line X1 = (1+beta)... is never executed. Have a look at this paper which outlines how the method works. – Daryl Sep 14 '12 at 10:16
  • Or use the inbuilt matlab function pinv(...). Type help pinv to display the help for this function. – Daryl Sep 14 '12 at 10:17
  • i am reading the same paper ..And I am trying to implement taht method on matlab...but still no success... – Srijan Sep 14 '12 at 10:25
  • I will get my matlab version on and check. – Daryl Sep 14 '12 at 10:31