/* *********************************************************************
   | The Q language - A C++ extension for programming quantum machines |
   | Copyright (C) 2000 2001 2002 2003 Stefano Bettelli                |
   | <bettelli@irsamc.ups-tlse.fr>                                     |
   | See the COPYING and LICENSE files for license terms.              |
   ********************************************************************* */

This is the protocol for communication between the language on a classical
machine and a quantum device. All the communication is done through a
sequence of quantum_message_type numbers (defined in "qinterface_types.h",
it should be an unsigned long). All operation codes are single numbers,
see "qop_codes.h" for actual values. Starting from the classical machine:

OPCODE_INITIALIZATION	VALUE		LIST
OPCODE_MEASURE              		LIST
OPCODE_HADAMARD				LIST
OPCODE_PHASE		PARAMETER	LIST
OPCODE_COND_PHASE	PARAMETER	LIST
OPCODE_LOCATE				LIST (commun. with the driver)

PARAMETER is a single quantum_message_type object which defines the phase
parameter for a phase gate, which is exp(2 PI i PARAMETER / 2^N) where
N is the number of bits in a quantum_message_type object.

VALUE is the encoding of a vector of booleans: it consists of a single
number QUBIT_NUM (which specifies the number of qubits to be initialized)
followed by ceil(QUBIT_NUM/S) numbers (which are to be interpreted as
bitmasks), S being the number of bits in a quantum_message_type number.

LIST is the encoding or a Qubit_list object: it consists of a single
number REG_SIZE (which specifies the number of segments) followed by
REG_SIZE pairs of the form (FIRST LAST), each of which specifies a qubit
segment. Hence a list with k segments is encoded in 2k+1 numbers.
When the operation needs more than one list, the encoded list is to be
further splitted into two or more lists, by assigning segments to lists
with round-robin (corresponding segments have the same size).
Therefore m lists with k segments each are encoded in mk+1 numbers.
