[−][src]Function dqcsim::bindings::dqcs_mat_new
#[no_mangle]pub extern "C" fn dqcs_mat_new(
num_qubits: size_t,
matrix: *const c_double
) -> dqcs_handle_t
Constructs a new gate matrix. >
num_qubits
must be set to the number of qubits mutated by this matrix. It must be greater than or equal to zero.matrix
must point to an appropriately sized array of doubles. The matrix is specified in row-major form, using pairs of doubles for the real vs. imaginary component of each entry. The size must be4**num_qubits
complex numbers =2*4**num_qubits
doubles =16*4**num_qubits
bytes, representing a2**num_qubits
by2**num_qubits
matrix. This function returns the constructed matrix handle, or 0 if an error occurs.While not enforced at this level, the matrix is normally unitary, or approximately so within some floating-point error margin.
This function returns the handle to the matrix, or 0 to indicate failure.