For brevity, collect all vectors \( \left\{\boldsymbol{a}_{i}\right\}_{i=1}^{m} \) in the \( m \times n \) matrix \( \boldsymbol{A}:=\left[\begin{array}{lll}\boldsymbol{a}_{1} & \cdots & \boldsymbol{a}_{m}\end{array}\right]^{\mathcal{T}} \), and all amplitudes \( \left\{\psi_{i}\right\}_{i=1}^{m} \) to form the vector \( \boldsymbol{\psi}:=\left[\begin{array}{lll}\psi_{1} & \cdots & \psi_{m}\end{array}\right]^{\mathcal{T}} \). One can rewrite the amplitudebased cost function in matrix-vector representation as
\[
\underset{z \in \mathbb{R}^{n}}{\operatorname{minimize}} \ell(z):=\frac{1}{m} \sum_{i=1}^{m} \ell_{i}(z)=\frac{1}{2 m}\|\boldsymbol{\psi}-|\boldsymbol{A} \boldsymbol{z}|\|^{2}
\]
where \( \ell_{i}(z):=\frac{1}{2}\left(\psi_{i}-\left|\boldsymbol{a}_{i}^{\mathcal{T}} z\right|\right)^{2} \) with the superscript \( { }^{\mathcal{T}}\left({ }^{\mathcal{H}}\right) \) denoting (Hermitian) transpose; and with a slight abuse of notation, \( |\boldsymbol{A} z|:=\left[\left|\boldsymbol{a}_{1}^{\mathcal{T}} z\right| \cdots\left|\boldsymbol{a}_{m}^{\mathcal{T}} z\right|\right]^{\mathcal{T}} \). Apart from being