Input: , and
Output: , and
(1)   function ESTIMATING  BY LS
(2)   w select an initial value for w
(3)   select an initial value for
(4)   solve the optimization problem of P1 (12) and find the solution .
(5)   return  S
(6)   end function
(7)
(8)   function ESTIMATING  w  BY MAXIMIZING THE OUTPUT SNR
(9)   the optimum of P1.
(10)  the initial value of .
(11)  w solve the optimization problem of P2 (15) and find the solution w.
(12)  return  w
(13) end function
(14)
(15) function ESTIMATING    BY MAXIMIZING THE CHANNEL CAPACITY
(16) S the optimum S of P1.
(17) w the optimum w of P2.
(18)  solve the optimization problem of P3 (18) and find the solution .
(19) return  
(20) end function
(21)
(22) Iteration: Rerun the steps 1 to 20 for some appropriate number of iterations and the
achievable performance will be the average of results at that specific SNR.
(23) return  w, S and
(24) Finally, the antennas are chosen corresponding to the -largest diagonal elements of .
Algorithm 1: Processing procedure of the proposed low-complexity and joint transmit antenna selection and beamforming for large-scale MIMO communications.