[][src]Function dqcsim::bindings::dqcs_gate_new_predef

#[no_mangle]pub extern "C" fn dqcs_gate_new_predef(
    gate_type: dqcs_predefined_gate_t,
    qubits: dqcs_handle_t,
    param_data: dqcs_handle_t
) -> dqcs_handle_t

Constructs a new predefined unitary gate.

gate_type specifies which kind of gate should be constructed.

targets must be a handle to a non-empty qubit set, containing at least as many qubits as needed for the specified gate type. If more qubits are specified, the rightmost qubits become the targets, and the remaining qubits become control qubits to make a controlled gate.

param_data takes an optional ArbData object used to parameterize the gate if necessary. If not specified, an empty object is used. Some of the gate types are parameterized, and use values from this ArbData as defined in the docs for dqcs_predefined_gate_t. Anything remaining in the ArbData afterwards is placed in the gate object.

This function returns the handle to the gate, or 0 to indicate failure. The qubit set and parameterization data (if specified) are consumed/deleted by this function if and only if it succeeds.