# RIS-Assisted Cooperative Time-Division Multiple Access
## 2 RIS-Assisted Cooperative Time-Division Multiple Access
### Proposed Algorithm
\begin{table}
\begin{tabular}{l} \hline \hline \multicolumn{2}{l}{**Step 1. Initialization**} \\ \(1:Count_{1}=Count_{2}=0\), a given random phase-shift diagonal matrix \(\mathbf{\Phi}\) \\ \(2:\mathbf{W}_{weak}(\in\mathbb{C}^{M\times T})=\mathbf{0}\), \(\mathbf{W}_{strong}(\in\mathbb{C}^{M\times T})=\mathbf{0}\), \(\mathcal{T}=\mathbf{\phi}\) \\ \(3:\mathbf{H}_{sort}=[\mathbf{h}_{1}^{H},\ldots,\mathbf{h}_{K-1}^{H},\mathbf{h }_{K}^{H}]^{H}\), where \(\|\mathbf{h}_{1}\|\leq\ldots\leq\|\mathbf{h}_{T-1}\|\leqq\|\mathbf{h}_{K}\|\) \\ \(4:\mathbf{G}_{sort}=[\mathbf{g}_{1}^{H},\ldots,\mathbf{g}_{K-1}^{H},\mathbf{g }_{K}^{H}]^{H}\), where \(\mathbf{g}_{i}\) is associated with \(\mathbf{h}_{i}\). \\ \(5:\mathbf{for}k=1:K\)do \\ \(6:\)\(SINR_{k}=\rho\|\mathbf{H}_{sort}(k,:))\|^{2}\) using (2) and (9) \\ \(7:\)\(\mathbf{if}\)\(SINR_{k}<\gamma_{req}\), then \\ \(8:\)\(Count_{1}=Count_{1}+1\) \\ \(9:\)\(\mathbf{W}_{weak}(:,k)=\frac{\mathbf{H}_{sort}(k,:)^{H}}{\|\mathbf{H}_{sort}(k,: )\|}\) using (9) \\ \(10:\)\(\mathbf{else}\) \\ \(11:\)\(Count_{2}=Count_{2}+1\) \\ \(12:\)\(\mathbf{W}_{strong}(:,k)=\frac{\mathbf{H}_{sort}(k,:)^{H}}{\|\mathbf{H}_{sort}(k,:)\|}\) using (9) \\ \(13:\)\(\mathbf{end}\) \\ \(14:\)\(\mathbf{end}\) \\ \(15:N_{c}=\min(Count_{1},Count_{2})\) \\ \hline \multicolumn{2}{l}{**Step 2. User pairing and Transmit Beamforming Vector Design**} \\ \(16:\)\(\mathbf{for}\)\(k=1:N_{c}\)do \\ \(17:\)\(\mathbf{Index}=0\), \(\mathrm{TSINR}=0\) \\ \(18:\)\(\mathbf{for}\)\(t=T-Count_{2}+1:T\)do \\ \(19:\)\(\mathbf{if}\)\(t\in\mathcal{T}\)then go to line 30 \\ \(20:\)\(\mathbf{w}_{c,s}=\max\). eigenvector of \((\mathbf{G}_{sort}(t,:)\mathbf{\Phi}\mathbf{H}+\mathbf{H}_{sort}(t,:))^{H}( \mathbf{G}_{sort}(t,:)\mathbf{\Phi}\mathbf{H}+\mathbf{H}_{sort}(t,:))\) \\   using (11) \\ \(21:\)\(\rho_{s}=\frac{\gamma_{req}}{(\mathbf{w}_{c,s})^{H}(\mathbf{G}_{sort}(t,:) \mathbf{\Phi}\mathbf{H}+\mathbf{H}_{sort}(t,:)^{H}(\mathbf{G}_{sort}(t,:) \mathbf{\Phi}\mathbf{H}+\mathbf{H}_{sort}(t,:))\mathbf{w}_{c,s}^{H}}\) using (12) \\ \(22:\)\(\rho_{w}=\rho-\rho_{s}\) using (13) \\ \(23:\)\(\mathbf{w}_{c,w}^{max}=\max\). eigenvector of \((\mathbf{H}^{H}\mathbf{\[PERSON]}^{H}\mathbf{G}_{sort}(k,:)^{H}\mathbf{G}_{sort}(k,:)\mathbf{\[PERSON]}\mathbf{H}+\mathbf{H}_{sort}(k,:)^{H}\mathbf{H}_{sort}(k,:))\) \\   using (15) \\ \(24:\)\(\mathbf{w}_{c,w}=\frac{\rho-\rho_{s}\|\mathbf{G}_{sort}^{H}(k,:)\mathbf{\[PERSON]} \mathbf{H}+\mathbf{H}_{sort}(k,:)\mathbf{w}_{c,w}\|^{2}}{1+\rho_{s}\|\mathbf{ G}_{sort}(k,:)\mathbf{\Phi}\mathbf{H}+\mathbf{H}_{sort}(k,:)\mathbf{w}_{c,w}\|^{2}}\) using (17) \\ \(25:\)\(\mathrm{SINR}_{c,w}=\frac{\rho-\rho_{s}\|\mathbf{G}_{sort}^{H}(k,:)\mathbf{\Phi} \mathbf{H}+\mathbf{H}_{sort}(k,:)\mathbf{w}_{c,w}\|^{2}}{1+\rho_{s}\|\mathbf{ G}_{sort}(k,:)\mathbf{\Phi}\mathbf{H}+\mathbf{H}_{sort}(k,:)\mathbf{w}_{c,w}\|^{2}}\) using (14) \\ \(26:\)\(\mathbf{if}\)\(\mathrm{TSINR}<\mathrm{SINR}_{c,w}\), then \\ \(27:\)\(\mathrm{TSINR}=\mathrm{SINR}_{c,w}\), \(\mathbf{w}_{s}=\mathbf{w}_{c,s}\) and \(\mathbf{w}_{w}=\mathbf{w}_{c,w}\) \\ \(28:\)\(\mathbf{\mathit{Index}}=t\) \\ \(29:\)\(\mathbf{\mathit{End}}\) \\ \(30:\)\(\mathbf{\mathit{end}}\) \\ \(31:\)\(\mathbf{W}_{strong}(:,Index)=\mathbf{w}_{s}\)and \(\mathbf{W}_{weak}(:,Index)=\mathbf{w}_{w}\) \\ \(32:\)\(\mathcal{T}=[\mathcal{T},Index]\) \\ \(33:\)\(\mathbf{end}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: RIS-assisted Cooperative TDMA Algorithm. In Step 2, the user pairing is performed, which is the user scheduling for a cooperative time slot. If a user pairing is performed in a cooperative time slot, two users, i.e., one weak-channel-conditioned UE and one strong-channel-conditioned UE, are simultaneously served in that cooperative time slot. In lines 16 to 29, the indexes \(k\) and \(t\) corresponding to for-loops indicate the \(N_{c}\) weak-channel-conditioned UEs and \(Count_{2}\) strong-channel-conditioned UEs, respectively.