#[no_mangle]
pub unsafe extern "C" fn init(
initial_capacity: usize,
representation: *const c_char,
sim_id_out: *mut usize,
) -> i64
Expand description
Allocate a new simulator with a given capacity, measured in the number of qubits supported by that simulator. Returns an id that can be used to refer to the new simulator in future function calls.
The initial state of the new simulator is populated using the
representation nominated by the representation
argument:
pure
: Creates the simulator with an initial state represented by a state vector.mixed
: Creates the simulator with an initial state represented by a density operator.stabilizer
: Creates the simulator with an initial state represented by a stabilizer tableau.
ยงSafety
The caller is responsible for:
- Ensuring that
sim_id_out
points to valid memory, and that the lifetime of this pointer extends at least for the duration of this call. - Ensuring that
representation
is a valid pointer to a null-terminated string of Unicode characters, encoded as UTF-8.