qgame::QSys Class Reference
[Top Level Interfaces]

A quantum system, the main interface to use QGame++. More...

#include <qgame++.h>

List of all members.

Public Member Functions

void init (int numQubits, QProgram *prg, const std::string &oracleTT)
 Initialize a quantum system with the provided data, setting the register to |00..0> and installing the truth table to the oracle gates found in prg.

QSysclone (double priorProb)
 Return a new QSys object that is a clone of the current one, and has the given prior probability.

Qureg getReg ()
 Get contents of the system's quantum register.

void setReg (const Qureg &)
 Set the system's quantum register.

double getProb ()
 Get prior probability of quantum system.

void setProb (double prob)
 Set prior probability of quantum system.

int getOracleCount ()
 Get the number of oracle calls in the history of this system.

std::vector< MeasurementgetMeasurementHistory ()
 Get the measurement history of the system.

void apply (QGate *, const QubitList &) throw (Error)
 Apply a QGate to the given qubits.

void apply (const QInstr &) throw (Error)
 Apply an instruction given as a string.


Static Public Member Functions

std::vector< QSys * > execute (int numQubits, QProgram *prg, const std::string &oracleTT) throw (Error)
 Execute the given program and return a list of pointers to the resulting QSys objects, each with its own measurement history and resulting prior probability.

Result testProgram (int numQubits, QProgram *prg, const std::vector< TestCase > &cases, const QubitList &finalMeasure, double threshold) throw (Error)
 Perform a number of test runs on the provided test cases as described in the class description, and return stats as a result.


Friends

std::ostream & operator<< (std::ostream &, const QSys &)


Detailed Description

A quantum system, the main interface to use QGame++.

The core of a quantum system is a quantum register containing a certain number of qubits, which are being manipulated by a quantum program given as a QProgram object. A QSys object can be cloned (a functionality that is mostly used for executing different branches after a measurement). There are two main ways to run a program; both involve calling a static method:

Definition at line 82 of file qgame++.h.


Member Function Documentation

void QSys::apply const QInstr  )  throw (Error)
 

Apply an instruction given as a string.

Instructions that do not contain gates, such as control flow instructions or measurements, will be ignored.

Definition at line 114 of file qgame++.cpp.

vector< QSys * > QSys::execute int  numQubits,
QProgram prg,
const std::string &  oracleTT
throw (Error) [static]
 

Execute the given program and return a list of pointers to the resulting QSys objects, each with its own measurement history and resulting prior probability.

You have to take care of deleting the QSys objects yourself if they are no longer needed.

Definition at line 124 of file qgame++.cpp.

References exec(), and init().

Result QSys::testProgram int  numQubits,
QProgram prg,
const std::vector< TestCase > &  cases,
const QubitList finalMeasure,
double  threshold
throw (Error) [static]
 

Perform a number of test runs on the provided test cases as described in the class description, and return stats as a result.

Parameters:
numqb  Number of qubits
p  Pointer to program
cases  List of test cases
finm  Qubits for final measurement
thresh  Threshold for error

Definition at line 217 of file qgame++.cpp.

References qgame::Result::avgError, qgame::Result::avgExpOracles, qgame::TestCase::desiredRes, qgame::Result::maxError, qgame::Result::maxExpOracles, qgame::Result::misses, and qgame::TestCase::oracleTT.


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