[][src]Function dqcsim::bindings::dqcs_mat_is_predef

#[no_mangle]pub extern "C" fn dqcs_mat_is_predef(
    mat: dqcs_handle_t,
    gate_type: dqcs_predefined_gate_t,
    param_data: *mut dqcs_handle_t,
    epsilon: c_double,
    ignore_gphase: bool
) -> dqcs_bool_return_t

Returns whether this matrix is of the given predefined form and, if it is, any parameters needed to describe it. >

mat is a borrowed handle to the matrix to check. gate_type specifies which kind of gate should be detected. param_data, if non-null, receives a new ArbData handle with parameterization data, or an empty ArbData if the gate is not parameterized; the caller must delete this object when it is done with it. This function always writes the 0 handle to this return parameter if it fails. The ArbData representation can be found in the documentation for dqcs_predefined_gate_t.

epsilon specifies the maximum element-wise root-mean-square error between the matrices that results in a positive match. ignore_gphase specifies whether the check should ignore global phase.

This function returns DQCS_TRUE if the matrices match according to the aforementioned criteria, or DQCS_FALSE if not. DQCS_BOOL_ERROR is used when either handle is invalid or not a matrix. If the matrices differ in dimensionality, DQCS_FALSE is used.