[][src]Function dqcsim::bindings::dqcs_mat_basis_approx_eq

#[no_mangle]pub extern "C" fn dqcs_mat_basis_approx_eq(
    a: dqcs_handle_t,
    b: dqcs_handle_t,
    epsilon: c_double
) -> dqcs_bool_return_t

Approximately compares two basis matrices. >

a and b are borrowed matrix handles. epsilon specifies the maximum element-wise root-mean-square error between the matrices that results in a positive match.

This checks that the following holds for some x and y:

\f[ A \cdot \begin{bmatrix} e^{ix} & 0 \ 0 & e^{iy} \end{bmatrix} \approx B \f]

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 either matrix is not 2x2, DQCS_FALSE is used.