qgame::Qureg Class Reference
[Basic Types]

A quantum register. More...

#include <qgtypes.h>

List of all members.

Public Member Functions

 Qureg (int size=0)
 The size of the Qureg (number of qubits, NOT amplitudes) must be given.

unsigned int size () const
 Returns the size of the Qureg (number of qubits, NOT amplitudes).

std::vector< QuSubReggetSubRegs (const QubitList &qubits)
 Returns a vector of QuSubReg objects, that is, references to the amplitudes referenced by the QubitList.

std::vector< double > getProbabilities (const QubitList &qubits)
 Returns a list of probabilities for measuring the given qubits, in binary order as given in the QubitList.

void collapse (const QubitList &qubits, int value)
 Collapses the given qubits to the value given (which can be thought as a binary value corresponding to the given QubitList).

void normalize ()
 Normalize the Qureg, so that all probabilities sum to 1.

Complexoperator[] (const unsigned int) throw (Error)
 Returns a reference to the addressed amplitude.


Friends

std::ostream & operator<< (std::ostream &, Qureg)


Detailed Description

A quantum register.

This class represents a quantum register and provides manipulation functions. If you need to access a part of the Qureg as addressed by a number of qubits (in arbitrary order), use getSubRegs(QubitList). You can address individual amplitudes by using [].

Definition at line 115 of file qgtypes.h.


Member Function Documentation

void Qureg::collapse const QubitList qubits,
int  value
 

Collapses the given qubits to the value given (which can be thought as a binary value corresponding to the given QubitList).

No normalization is done by now, although this might change in later versions of QGame++ to provide a more physically accurate behavior.

Definition at line 206 of file qgtypes.cpp.

References getSubRegs(), and normalize().

vector< QuSubReg > Qureg::getSubRegs const QubitList qubits  ) 
 

Returns a vector of QuSubReg objects, that is, references to the amplitudes referenced by the QubitList.

Each QuSubReg object contains references to the amplitudes of the qubits referenced by the given QubitList, with the first qubit number added to the list being the least signicant. The QuSubReg objects are in binary order as addressed by the remaining qubits not in the QubitList, with the rightmost of these qubits being the least significant.

For example, having a 3 qubit Qureg and a QubitList containing 1 (this means, the middle qubit should be manipulated), you would get four QuSubReg objects: { |000>, |010> } , { |001>, |011> }, { |100>, |110> }, { |101>, |111> }

Definition at line 153 of file qgtypes.cpp.

References qgame::QubitList::append(), qgame::QubitList::size(), and qgame::QuSubReg::sub.

Referenced by collapse(), and getProbabilities().


The documentation for this class was generated from the following files:
Generated on Sat Apr 3 18:42:39 2004 for QGame++ by doxygen 1.3.5