# Two-Dimensional Permutation Vectors' (PV) Code for Optical Code Division Multiple Access Systems
## 2 The 2D Wavelength-Hopping/Time-Spreading System
### One-Dimensional Approach  
Let \(\mathbb{R}\) refer to the field of real numbers. The space of all \(m\)-tuples of real numbers forms an \(m\)-dimensional vector space over \(\mathbb{R}\) and represented by \(\mathbb{R}^{m}\). The dimension of the vector space \(U\) over the field \(\mathbb{R}\) can be written as \(\dim\)\(\mathbb{R}\) (U) or as [U: \(\mathbb{R}\)]. An element \(U\) of \(\mathbb{R}^{m}\) can be represented as vertical vector:  
\[U=\left\{ \begin{array}{c}u_{1}\\ u_{2}\\.\\.\\ u_{m}\end{array} \right\}. \tag{2}\]  
Therefore, the \(\dim\)\(\mathbb{R}(\mathbb{R}^{3})\) = 3. In general, \(\dim\)\(\mathbb{R}(\mathbb{R}^{m})\) = m.  
Using the standard unit basis vectors, any vector \(U=\left( \begin{array}{c}u_{1}\\ u_{2}\\.\\.\\ u_{m}\end{array} \right)\in\mathbb{R}^{m}\) can be expressed as a linear combination \(U=u_{1}e_{1}+u_{2}e_{m}+\ldots+u_{m}e_{m}\), where \(e_{1},\ e_{2},\ldots,\ e_{m}\) are the standard unit basis vectors of \(\mathbb{R}^{m}\). Let T: \(\mathbb{R}^{m}\rightarrow\mathbb{R}^{m}\) be a linear transformation defined such that:  
\[T(e_{1})=\left( \begin{array}{c}1\\ 0\\ 0\\.\\.\\ 0\end{array} \right);\ T(e_{2})=\left( \begin{array}{c}0\\ 1\\ 0\\.\\.\\ 0\end{array} \right);\ldots\ldots,T(e_{m})=\left( \begin{array}{c}0\\ 0\\ 0\\.\\.\\.\\ 1\end{array} \right). \tag{3}\]The representation matrix is:  
\[[T(e_{1}),\ T(e_{2}),\ldots,T(e_{m})]=\left(\left( \begin{array}{c}1\\ 0\\ 0\\.\\ 0\end{array} \right)\left( \begin{array}{c}0\\ 1\\ 0\\.\\ 0\end{array} \right)\left( \begin{array}{c}0\\ 1\\ 0\\.\\ 0\end{array} \right)\left( \begin{array}{c}0\\ 0\\.\\.\\ 1\end{array} \right)\right) \tag{4}\]  
For example, the vector space \(\mathbb{R}^{4}\) is represented as:  
\[[T(e_{1}),\ T(e_{2}),T(e_{3}),T(e_{4})]=\left(\left( \begin{array}{c}1\\ 0\\ 0\\ 0\end{array} \right)\left( \begin{array}{c}0\\ 1\\ 0\\ 0\end{array} \right)\left( \begin{array}{c}0\\ 0\\ 1\\ 0\end{array} \right)\left( \begin{array}{c}0\\ 0\\ 1\end{array} \right)\right)\]  
A permutation vector is a \(1\times n\) or \(n\times 1\) vector of the integers \(1\) through \(n\). The following permutation matrix and permutation vector are equivalent:  
\[Perm=\left[ \begin{array}{c}1\\ 2\\ 3\\ 4\end{array} \right]\Leftrightarrow[T(e_{1}),\ T(e_{2}),T(e_{3}),T(e_{4})]= \left(\left( \begin{array}{c}1\\ 0\\ 0\\ 0\end{array} \right)\left( \begin{array}{c}0\\ 1\\ 0\\ 0\end{array} \right)\left( \begin{array}{c}0\\ 0\\ 1\\ 0\end{array} \right)\left( \begin{array}{c}0\\ 0\\ 1\end{array} \right)\right)\]  
Based on the above definitions and given the number of users \(K\) and the weight \(W\), we can generate all possibilities of 1D-PV by getting all permutations of the vectors with repetition of \([T(e_{1}),\ T(e_{2}),\ldots,T(e_{k-1})]\) each vector \(w\) times. Hence, the 1D-PV codes consists of \(K\times l\) matrix functionally depending on the value of the number of users (\(K\)) and code weight (\(w\)). These 1D-PV codes were constructed based on the vector space \(\mathbb{R}^{k}\) and an arbitrary permutation vector (\(Perm\)). \[1\mathrm{D-PV}=\left(\mathbb{R}^{k}\big{|}Perm\right)_{k\times l^{\prime}} \tag{5}\]  
where \(Perm\) is a permutation vector used to permute the columns of the representation matrix of \(\mathbb{R}^{k}\), the permuted \(\mathbb{R}^{k}\) is obtained using Equation (6):  
\[\hat{\mathbb{R}}^{k}=\mathbb{R}^{k}[.,Perm]. \tag{6}\]  
Moreover, the proposed 1D - PV is designed such that:  
* Cross-correlation between each row is equal to 0. * Each column is an element of the vector space \(\mathbb{R}^{k}\). * Number of \(Perm\) possibilities is equal to \(PV_{\mathrm{poss}}=\frac{(\mathrm{WK})!}{(\mathrm{w}^{\prime}[(\mathrm{L-w})!)}\). Thus, the basic form of \(1\mathrm{D-PV}\) for \(k=w=2\) while using the above-mentioned properties can be written in six forms as:  
\[(1\mathrm{D-PV})_{1}=\left(\mathbb{R}^{2}\big{|}(1,1,2,2)\right)=\left[T(e_{1 }),\ T(e_{1}),T(e_{2}),T(e_{2})\right]=\left( \begin{array}{ccc}1&1&0&0\\ 0&0&1&1\end{array}