Input: Input the matrices and the accurate value ; Output: The algorithm export the matrix: ; Begin: Assignment the matrix by the initial value matrix , that is ; Assigned the matrix by , that is ; Computed the product of and , and assigned its value to . that is ; Similarly, we repeatedly do the computation for the product and as well as above the computation, where . Computed the product of the matrix and , and assigned its value to as well as above computations, that is ; Assigned the matrix by the sum of the matrices , where and . that is ; Take the norm of and assigned its value to . that is ; while do; We need the iteration not to exceed 500 times. that is ; (In fact ) Do 500 step repeatedly computations in the following. that is For 1 : Computed the product of the given matrix and the iteration matrix , and assigned its value to the new matrix . that is ; From the iteration , we obtain the new matrix and add its value to , and assigned the sum of and to the matrix ..that is ; After these, return the the step . Finished the For loop function that is end Computed the error between and , that is ; Finished the While loop function. that is end The matrix multiplied by and assigned to , that is ; End the algorithm.
Algorithm 2: SMS algorithm for computing the generalized inverse .