# Numerically Optimized Fourier Transform-Based Beamforming Accelerated by Neural Networks
## 3 Algorithms for Phase Distribution Optimization
### Clustering of \((u,v)\)-Space during Optimization  
To produce an efficient algorithm for optimization of the phase distribution, one should create a suitable cost function related to the reconstructed electric field pattern. Then, the desired pattern characteristics can be improved by manipulating the phase distribution over the PMS aperture. In particular, the cost function should be defined in such a way that the optimization leads to an increase in the main beam's amplitude and suppression of the sidelobes. For this goal, the whole area in \((u,v)\)-space is clustered into three sections, as explained next.  
According to the operating frequency and the PMS physical size, there are regions of the \((u,v)\)-space that correspond to the propagating waves, for which the normalized propagation constant \(k_{z}d\equiv\sqrt{(k_{0}d)^{2}-u^{2}-v^{2}}\) is purely real, and to the evanescent waves with imaginary propagation constant along the \(z\)-axis. We call the region that corresponds to the evanescent waves the Invisible Area (IA). This region does not affect the main lobe or the sidelobes located in the physical region of propagating waves.  
Correspondingly, the Visible Area (VA) corresponds to the part of the \((u,v)\)-space that is characterized with the real-valued propagation constants, and any changes to the phase distribution that affect this area will affect the main lobe and the sidelobes. It is evident from the above that the VA is a disk centered at the point \((0,0)\) in the \((u,v)\)-space with the radius equal to \(k_{0}d\).  
The third cluster that we consider is formed by the oval-shaped Protected Areas (PAs) defined around the main beams. The primary purpose of specifying PAs is to avoid a decrease in the main beam magnitude during the optimization process due to the phase distribution manipulation over the MS. The centers of the PAs are positioned at the locations of the main beams, \((u_{0,i},v_{0,i})\), in the \((u,v)\)-space. In some situations, PAs intersect with the IA, which depends on the beams' direction/location and the selected PAs radii. However, locating these areas inside the visible area is more beneficial and helps to obtain the highest possible PMS performance.  
The radii of the PAs are determined by solving Equations (7) and (8) and multiplying the results by \(2\pi/s_{x}\) and \(2\pi/s_{y}\), respectively:  
\[\text{sinc}\left(u\right)=1/p\Rightarrow\text{root}\;u^{\prime}>0\xrightarrow{ scaling}u^{\prime\prime}=\frac{2\pi u^{\prime}}{s_{x}}, \tag{7}\]  
\[\text{sinc}\left(v\right)=1/q\Rightarrow\text{root}\;v^{\prime}>0\xrightarrow{ scaling}v^{\prime\prime}=\frac{2\pi v^{\prime}}{s_{y}}. \tag{8}\]  
Therefore, each PA corresponds to the interior part of an ellipse as given by  
\[\frac{(u-u_{0,i})^{2}}{u^{\prime\prime 2}}+\frac{(v-v_{0,i})^{2}}{v^{\prime \prime 2}}=1.\]  
Increasing or decreasing the values of the parameters \(1<p\leq 4\), \(1<q\leq 4\) increases or decreases the radii of PAs. Therefore, to cover at least the Half-Power Beam Width (HPBW) of the main beams, the values of \(p\) and \(q\) should be adjusted considering the operating frequency, the number of MS elements, etc.  
Consequently, every point \((u,v)\) that satisfies the following inequality [Equation (9)] belongs to the corresponding PA:  
\[\text{PA}_{i}:\quad\forall(u,v),\quad\frac{(u-u_{0,i})^{2}}{u^{\prime\prime 2 }}+\frac{(v-v_{0,i})^{2}}{v^{\prime 2}}-1<0. \tag{9}\]