next up previous contents
Next: The Cluster Up: Parallelizing the Quantum Computing Previous: Sparse Matrix Computation   Contents

Saving the newly calculated Quantum State

When each of the parallel routines in "extern.cc" are finished, the new amplitudes of the baseterms are stored in an array. These values need to be stored in the same quantum state that the initial amplitudes were extracted from. The qc subdirectory of the QCL contains code that directly manipulates the quantum state. A new class was defined called opParallel, which contains a single function called apply. This function takes a quantum state and an array of amplitudes as parameters. The function finds out how many baseterms the quantum state contains, and then loops through each baseterm. It finds out the basevector of each baseterm and uses this to index in to the array of amplitudes to find the correct amplitude for this basevector. A new object of type complx is then constructed with the appropriate amplitude, and is stored in the quantum state.


\begin{lstlisting}[frame=trbl,caption=Extract from operator.cc]{}
void opParalle...
... // Store baseterm in quantum state
qs.setbaseterm(z, i);
}
}
\end{lstlisting}



Colm O hEigeartaigh 2003-05-30