diffsol-c 0.9.0

A diffsol wrapper featuring runtime scalar/matrix/solver types and a C API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::c_invalid_arg;
use crate::vjp_checkpoint::VjpCheckpointWrapper;

/// Free a VJP checkpoint previously returned by `diffsol_ode_solve_vjp_fwd`.
///
/// # Safety
/// `checkpoint` must be either null or a pointer returned by this library that has not
/// already been freed.
#[unsafe(no_mangle)]
pub unsafe extern "C" fn diffsol_vjp_checkpoint_free(checkpoint: *mut VjpCheckpointWrapper) {
    if checkpoint.is_null() {
        c_invalid_arg!("VJP checkpoint is null");
        return;
    }
    unsafe {
        drop(Box::from_raw(checkpoint));
    }
}