## 3 VPS and CPS Based PC-HBF
### Allocation of VPSs and CPSs to Antennas  
In the present work, our aim is to design analog precoders by dynamically allocating VPSs and CPSs to transmit antennas for maximizing the system sum rate. The optimization can be formulated as follows:  
\[\max_{\mathbf{F}_{VC}\mathbf{F}_{BB}}\quad\sum_{u=1}^{U}\log_{2 }\left(1+\frac{|\mathbf{h}_{u}^{H}\mathbf{F}_{VC}\mathbf{f}_{BB,u}|^{2}}{\sum _{l\
eq u}^{U}|\mathbf{h}_{u}^{H}\mathbf{F}_{VC}\mathbf{f}_{BB}|^{2}+\sigma^{ 2}}\right),\] \[\text{s.t.}\] \[\mathbf{F}_{VC}\in\mathcal{F},\,\text{Tr}\{\mathbf{F}_{VC}\mathbf{ F}_{BB}\mathbf{F}_{VC}^{H}\}\leq P, \tag{2}\]  
Figure 1: Hybrid precoding for massive multiple-input multiple output (MIMO) systems: (**a**) conventional (PC-HBF architecture; (**b**) proposed partially connected hybrid beamforming (PC-HBF) architecture. where \(P\) is the total transmit power at the base station, \(\mathbf{f}_{BB,u}=\mathbf{F}_{BB}(:,u)\) is the baseband precoding vector for \(s_{u}\), and \(\mathcal{F}\) is the set of feasible RF precoding matrices of the proposed PC-HBF architecture that employs VPSs and CPSs simultaneously. Finding an optimal solution to (2) can be immensely complicated. Therefore, we split optimization of the precoders into two stages. In the first stage, we set the digital precoder to an identity matrix and optimize the analog precoder by finding the switch matrix \(\{\hat{\mathbf{A}}_{u}\}\) that optimally allocates VPSs and CPSs to antennas. The corresponding optimization problem can be formulated as  
\[\{\hat{\mathbf{A}}_{u}\}_{u=1}^{U}=\] \[\arg\max_{\{\mathbf{A}_{u}\}_{u=1}^{U}}\sum_{u=1}^{U}\log_{2} \left(1+\frac{|\mathbf{h}_{u,u}^{H}\mathbf{f}_{VC,u}|^{2}}{\sum_{l\
eq u}^{U}| \mathbf{h}_{u,l}^{H}\mathbf{f}_{VC,l}|^{2}+\sigma^{2}}\right)\] s.t. \[\sum_{m=1}^{M}[\mathbf{\Delta}_{u}]_{m,j}=1,\] \[\sum_{m=1}^{M}[\mathbf{\Delta}_{u}]_{i,m}=1,\ \forall i,j\in[1,M], \tag{3}\]  
where \(\mathbf{h}_{u,l}\) is a sub-channel vector corresponding to the \(l\)th subarray, which is obtained by taking the elements in the range \(\{(l-1)M+1,lM\}\) of \(\mathbf{h}_{u}\). The VPS elements, \([\mathbf{f}_{u}]_{m}\), \(m=1,...,N_{V}\) can be selected such that \(\angle[\mathbf{f}_{u}]_{m}=\angle[\mathbf{h}_{u,u}^{H}\mathbf{\Delta}_{u}]_{m}\)[17], which implies that \(\mathbf{f}_{u}\) is determined by the choice of \(\mathbf{\Delta}_{u}\). The two constraints in (3) reflect the allowed design of the switch matrix. In particular, the first constraint ensures that each antenna is connected to only a single phase shifter, whereas the second constraint ensures that each phase shifter is connected to only a single antenna. After finding the optimal switch matrix \(\hat{\mathbf{A}}_{u}\) for each user, which provides \(\hat{\mathbf{F}}_{VC}\), the corresponding solution of \(\mathbf{F}_{VC}\), the unnormalized minimum mean square error (MMSE) precoder [18], is determined for digital precoding:  
\[\hat{\mathbf{V}}_{BB}=(\hat{\mathbf{F}}_{VC}^{H}\hat{\mathbf{H}}^{H}\hat{ \mathbf{H}}\hat{\mathbf{F}}_{VC}+\rho\hat{\mathbf{F}}_{VC}^{H}\hat{\mathbf{F} }_{VC})^{-1}\cdot\hat{\mathbf{F}}_{VC}^{H}\hat{\mathbf{H}}^{H}, \tag{4}\]  
where \(\hat{\mathbf{H}}=\sqrt{\gamma}\mathbf{H}\) and \(\rho=\frac{U\sigma^{2}}{P}\), whereas \(\gamma\) is the power-scaling factor such that the second constraint in (2) is satisfied. Then, the digital precoder is given by \(\hat{\mathbf{F}}_{BB}=\frac{1}{\sqrt{\gamma}}\hat{\mathbf{V}}_{BB}\). The problem in (3) is a combinatorial optimization problem, and to find its optimal solution, an exhaustive search through all possible combinations is required. The total number of candidates then becomes \((M!/N_{V}! )^{N_{RF}}\), which can be an extremely large number in the case of massive MIMO systems. To resolve this problem, we have developed a low-complexity yet near-optimal solution. The greedy VPS/CPS allocation algorithm, which is summarized in Algorithm 1, has been designed to reduce computational complexity while achieving near-optimal performance.