Public | ||
| QState () | : Default constructor. (Create one Qubit) | |
| QState (int size) | : Coefficients not specified. Use 1/sqrt(size)(|00..0> + ... + |11..1>) | |
| QState (int size, const Complex c[]) | : Constructor with initialization to complex amplitude array. | |
| ~QState () | : Default destructor. | |
| void | SetState (const Complex c[]) | : Set state to specified coefficients. |
| void | Print () const | : Display outcomes and coefficients (non destructive). |
| void | Dump (char filename[]) | : Dump state to file. (Oemer-like Format) |
| void | Read (char filename[]) | : Read state from file. |
| int | Outcomes () const | : Returns total number of outcomes. |
| operator | long () | : Implicit conversion operator causes destructive measure. |
Friends | ||
| friend void | Reset (QState &q) | : Reset to base state |00...0>. |
| friend long | Measure (QState &q) | : Destructive register measure. |
| friend short | Measure (QState &q, int i) | : Destructive bit measure. |
| friend double | norm (const QState &q) | : Sum of normalized amplitudes. |
Note that the collapsing functions do not return another
state, as suggested by Peter Belkner, but rather destroy
the *this state. This is more physically correct because
when we look at a quantum state in real life, we don't
get 'another' state, but rather the state we are looking
at collapses. After the collapse all the coefficients are
set to 0 except for that of the state that the register
collapsed to.