[−][src]Function dqcsim::bindings::dqcs_gate_new_measurement
#[no_mangle]pub extern "C" fn dqcs_gate_new_measurement(
measures: dqcs_handle_t,
matrix: dqcs_handle_t
) -> dqcs_handle_t
Constructs a new measurement gate.
measures
must be a handle to a qubit set. matrix
is an optional matrix
handle signifying the measurement basis. If zero, the Z basis is used.
Otherwise, it must be a handle to a unitary 2x2 matrix, and the semantics
of the measurement are as follows:
- apply the hermetian of the matrix to each qubit
- measure each qubit in the Z basis
- apply the matrix to each qubit
This function returns the handle to the gate, or 0 to indicate failure.
The measures
qubit set and matrix
handle are consumed/deleted by this
function if and only if it succeeds.