# Quantum Structure for Modelling Emotion Space of Robots
## 4 Quantum Emotion Manipulation and Retrieval
### Quantum Emotion Initialisation and Transition  
Like its use to encode quantum images [13], movies [19], and audio [23], utilising quantum mechanics to process emotion imposes the need to first store the emotions as quantum states. This is accomplished during the initialisation procedure for QES, which will now be described. For a general case, \(m+2n\) qubits are needed to construct a QES model. Therefore, the first step is to prepare \(m+2n\) qubits (conventionally as an array of computational basis states \(|0\rangle\)[8]) in the form of:  
\[|\Psi\rangle_{0}=|0\rangle^{\otimes m+2n}, \tag{15}\]  
where \(2n\) qubits are used to encode the QPA plane and \(m\) qubits are employed to realise the epoch (or time period). We consider the 2-D identity (\(I\)) and the Hadamard matrices (\(H\)) in Equation (16):  
\[I=\left( \begin{array}{cc}1&0\\ 0&1\end{array} \right),H=\frac{1}{\sqrt{2}}\left( \begin{array}{cc}1&1\\ 1&-1\end{array} \right), \tag{16}\]  
Figure 6: Quantum emotion transition and retrieval. where the tensor product of \(2n\) Identity matrices is denoted as \(I^{\otimes 2n}\) and that of \(m\) Hadamard matrices is denoted as \(H^{\otimes m}\) similarly with properties in the form:  
\[I|0\rangle=|0\rangle,H|0\rangle=\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle), \tag{17}\]  
the operation \(H^{\otimes m}\) is applied on the state \(|0\rangle^{\otimes m}\) (in Equation (15)) to initialise the robot's epoch (i.e., active cycle), and meanwhile, \(I^{\otimes 2n}\) is applied on \(|0\rangle^{\otimes 2n}\) (also in Equation (15)) to retain the robot's emotion unaltered (i.e., uninitialised) during the whole epoch. Applying the transform \(\mathcal{H}=I^{\otimes 2n}\otimes H^{\otimes m}\) on \(|0\rangle^{\otimes m+2n}\) produces the state \(|\Psi\rangle_{1}\):  
\[\mathcal{H}(|0\rangle^{\otimes m+2n})=\frac{1}{2^{m/2}}|0\rangle^{\otimes 2n }\otimes\sum\limits_{i=0}^{2^{m}-1}|i\rangle=|\Psi\rangle_{1}. \tag{18}\]  
We note that, thus far, the time information in the QES has been initialised, i.e., the robot's epoch or active cycle has been initialised. However, at this instant, there is no emotion state in the QES, but immediately when the robot receives an instantaneous stimulus from the outside world (e.g., at an instant \(|t\rangle\)), the stimulus will be processed by the ES using an emotional transformation matrix \(M_{t}\). The quantum sub-operation \(U_{t}\) that is used to manipulate emotion state at time \(|t\rangle\) is defined using Equation (19):  
\[U_{t}=\left(I^{\otimes 2n}\otimes\sum\limits_{i=0,i\
eq t}^{2^{m}-1}|i\rangle \langle i|\right)+\Omega_{t}\otimes|t\rangle\langle t|, \tag{19}\]  
where \(\Omega_{t}=\prod\limits_{k=1}^{t}M_{k}\) that is tensor product with \(|t\rangle\langle t|\) to constrain its operation worked on the specified time instant (time point). By utilising \(U_{t}\), the quantum emotion state at time \(|t\rangle\) is obtained using:  
\[ \begin{split} U_{t}(|\Psi\rangle_{1})&=U_{t}\Bigg{(} \frac{1}{2^{m/2}}\sum\limits_{i=0}^{t-1}|E_{i}\rangle|i\rangle+\frac{1}{2^{m/2 }}\sum\limits_{j=t}^{2^{m}-1}|0\rangle^{\otimes 2n}|j\rangle\Bigg{)}\\ &=\frac{1}{2^{m/2}}\Bigg{(}\sum\limits_{i=0}^{t-1}|E_{i}\rangle |i\rangle+\Omega_{t}|0\rangle^{\otimes 2n}|t\rangle+\sum\limits_{j=t+1}^{2^{m}-1}|0 \rangle^{\otimes 2n}|j\rangle\Bigg{)}\\ &=\frac{1}{2^{m/2}}\Bigg{(}\sum\limits_{i=0}^{t-1}|E_{i}\rangle |i\rangle+|E_{t}\rangle|t\rangle+\sum\limits_{j=t+1}^{2^{m}-1}|0\rangle^{ \otimes 2n}|j\rangle\Bigg{)}\\ &=\frac{1}{2^{m/2}}\Bigg{(}\sum\limits_{i=0}^{t}|E_{i}\rangle |i\rangle+\sum\limits_{j=t+1}^{2^{m}-1}|0\rangle^{\otimes 2n}|j\rangle\Bigg{)}.\end{split}  \tag{20}\]  
From Equation (20), it is obvious that the sub-operation \(U_{t}\) affects only the emotion value at time \(|t\rangle\). Therefore, we observe that a series of such sub-operations, where the time varies from 0 to \(2^{m}-1\) (i.e., \(\prod\limits_{t=0}^{2^{m}-1}U_{t}\)), will be required to construct a whole QES for robots whose procedure is presented as follows:  
\[