#include <quantum.h>
Collaboration diagram for ProductState:
Public Member Functions | |
ProductState (const TensorProductStructure &Uinit) | |
Constructor: constructs the zero state on a given TensorProductStructure. | |
ProductState (const ProductState &other) | |
Copy constructor: constructs an exact copy of another ProductState. | |
~ProductState () | |
Destructor: de-allocates the array of subsystem states. | |
ProductState & | operator= (const ProductState &other) |
Assignment operator: sets this ProductState equal to other , if their underlying structures are the same. | |
State & | Realize (State &fullstate) const |
Realizes the dense state vector represented by this ProductState, assigning it to the provided fullstate . | |
State & | AddTo (State &fullstate, complex amplitude=complex(1.0, 0)) const |
Realizes a scalar multiple of this ProductState, adding it to the provided fullstate . | |
State & | Component (itype index) |
Returns a reference to the state of the index 'th subsystem. | |
const State & | Component (itype index) const |
Returns a const reference to the state of the index 'th subsystem. | |
const State & | operator[] (itype index) const |
Returns a const reference to the state of the index 'th subsystem. | |
State & | operator[] (itype index) |
Returns a reference to the state of the index 'th subsystem. | |
const TensorProductStructure & | TPS () const |
Returns a const reference to this ProductState's underlying TensorProductStructure. | |
double | Norm () |
Calculates the squared 2-norm of this state, as the product of all the subsystem states' squared 2-norms. | |
ProductState & | Normalize () |
Normalizes this state, by normalizing the state of each subsystem. | |
ProductState & | Randomize () |
Assigns an unnormalized Gaussian random vector (Haar measure) to each subsystem state. |
ProductState is exactly what anyone familiar with quantum info would expect; it's a complex-valued vector defined as a tensor product of vectors on vector spaces corresponding to subsystems. This provides a tremendous savings in space. An arbitrary State vector in a 4x4x4-dimensional space requires storing 4x4x4=64 complex numbers, while a ProductState only requires 4+4+4=12 numbers. The advantage is exponential in the number of subsystems.
Each of the subsystem states in a ProductState can be accessed and changed at will, but the overall state's elements are not writable (and, as of 6/06, not directly accessible at all). Things you can do with a ProductState:
The ProductState class was put together rather hurriedly in late 2004 for a particular project, so it's not as well structured as it could be. At some point, it should be revised, but this will require updating old code (the Spinbath project) to make sure that it still works. Things to change include: make ProductState inherit from Vector<complex>; move the Randomize() function outside the class to match DenseVector<complex>; etc.