there is function: [RI,PMISet] = hRISelect(carrier,csirs,reportConfig,H,varargin) .
In short function should calculate post-processingSNR for each valid precode matrix of all valid ranks.
RI will be choosed based on zilion posible cost functions that related in some way to Channel Capacity maximization or weakest Eigan value maximization. In this case i think was used simple "Max-MMSE-PostCP Criterion Based RI Selection"[2].
My question is: What reason to multiply subbandSINRs, which have dimensions [subBand][iLayer], by factor rankIdx.
Line 351 and 353 of presented code
[1]Limited Feedback Unitary Precoding for Spatial Multiplexing Systems David J. Love, Member, IEEE, Robert W. Heath, Jr., Member, IEEE,
[2]Dynamic Transmission Mode Selection in LTE/LTE-Advanced System