# Comment evaluation corpus -- rust, needs labels
#
# Real own-line comments with the code that follows. Mark every `verdict:` as:
#
#   slop  - should not exist: restates the code, narrates an edit, labels a
#           section, leaks process, records history, or is a long explanation
#           where a short one would do
#   keep  - deleting it would lose a fact not recoverable from the code
#   skip  - genuinely cannot tell without more context
#
# Leave `?` on anything you do not reach; partial labelling still scores.
#
# Nothing here reveals which rule (if any) fires on a case, or how the case
# was sampled.

### 1  crates/diffsol-c/src/solve.rs:1
# Delegate solver types selected at runtime in Host to concrete solver types
# in Rust.
    use std::path::PathBuf;
    use crate::adjoint_checkpoint::AdjointCheckpointWrapper;
    use crate::error::DiffsolRtError;
verdict: keep

### 2  crates/diffsol-la/src/matrix/mod.rs:727
# --- Batched Matrix-generic tests ---
    pub fn test_batched_zeros_m<M: Matrix>(ctx: M::C) {
    assert_eq!(ctx.nbatch(), 2);
    let a = M::zeros(2, 3, ctx);
    assert_eq!(a.nrows(), 2);
verdict: slop

### 3  crates/diffsol-la/src/matrix/mod.rs:1509
# batch0: col0=[1,3], x=[1,0,0] → [1,3]
# batch1: col0=[5,7], x=[1,0,0] → [5,7]
    assert_eq!(
    y.clone_as_vec(),
    vec![f::<M>(1.0), f::<M>(3.0), f::<M>(5.0), f::<M>(7.0)]
    );
verdict: keep

### 4  crates/diffsol-la/src/vector/mod.rs:257
# TODO: would prefer to use From trait but not implemented for faer::Col
    fn clone_as_vec(&self) -> Vec<Self::T>;
    fn axpy(&mut self, alpha: Self::T, x: &Self, beta: Self::T);
verdict: keep

### 5  crates/diffsol/benches/lin_alg_ops.rs:466
# ═════════════════════════════════════════════════════════
# 🟢 LOW — rare: construction, indexing, batch ops
# ═════════════════════════════════════════════════════════
    fn bench_set_index<V: Vector<T = f64> + 'static>(c: &mut Criterion, label: &str)
    where
    V::C: Default + Clone,
    {
verdict: slop

### 6  crates/diffsol/benches/ode_solvers.rs:100
# -------------------------------------------------------------------------
    {
    let mut g = c.benchmark_group("exponential_decay");
    bench_implicit!(
    g,
verdict: slop

### 7  crates/diffsol/benches/ode_solvers.rs:376
# Heat1D (explicit, diffsl only)
    {
    let mut g = c.benchmark_group("heat1d");
    bench_diffsl_explicit_cg!(
    g,
verdict: keep

### 8  crates/diffsol/benches/ode_solvers_ci.rs:85
# Robertson
    {
    let mut g = c.benchmark_group("robertson_ci");
    bench_implicit!(
    g,
verdict: keep

### 9  crates/diffsol/benches/ode_solvers_ci.rs:159
# -------------------------------------------------------------------------
    {
    let mut g = c.benchmark_group("heat2d_ci");
    bench_implicit_cg!(
    g,
verdict: slop

### 10  crates/diffsol/benches/ode_solvers_ci.rs:197
# -------------------------------------------------------------------------
    {
    let mut g = c.benchmark_group("foodweb_ci");
    bench_implicit_cg!(
    g,
verdict: slop

### 11  crates/diffsol/src/nonlinear_solver/root.rs:90
# otherwise we need to do the modified secant method to find the root
    let mut imax = IndexType::try_from(imax).unwrap();
    let mut alpha = V::T::one();
    let mut sign_change = [false, true];
    let mut i = 0;
verdict: keep

### 12  crates/diffsol/src/ode_equations/adjoint_equations.rs:121
# for diffsl, we need to set data for the adjoint state!
# basically just involves calling the normal rhs function with the new self.x
    self.eqn.rhs().call(&self.x, t_interp);
    }
    pub fn state(&self) -> &Eqn::V {
    &self.x
verdict: keep

### 13  crates/diffsol/src/ode_equations/adjoint_equations.rs:339
# y = -f^T_x(x, t) λ - g^T_x(x,t)
    if self.with_out {
    let col = context.col();
    if let Some(out) = self.eqn.out() {
    let mut tmp = self.tmp.borrow_mut();
verdict: keep

### 14  crates/diffsol/src/ode_equations/adjoint_equations.rs:923
# dy/dt = -ay (p = [a])
# a = 0.1
    let (problem, _soln) = exponential_decay_problem_adjoint::<FaerSparseMat<f64>>(true, true);
    let ctx = problem.eqn.context();
    let state = RkState {
    t: 0.0,
verdict: keep

### 15  crates/diffsol/src/ode_equations/diffsl.rs:1250
# scale y by beta
    y.mul_assign(Scale(beta));
    let mut tmp = self.0.context.tmp.borrow_mut();
    tmp.copy_from(x);
verdict: slop

### 16  crates/diffsol/src/ode_equations/diffsl.rs:1373
# Re-imports only needed for certain cfg-gated test paths.
# Keep as public (but unused) for those feature combinations.
    use crate::{
    op::{
    linear_op::LinearOp,
    nonlinear_op::{NonLinearOp, NonLinearOpJacobian},
verdict: keep

### 17  crates/diffsol/src/ode_equations/diffsl.rs:1507
# x = (y, z) = (a, 2) = (3, 2) after set_params
    let x = eqn.init().call(M::T::zero());
    let t = M::T::zero();
    let reset_op = eqn.reset().expect("model must have a reset operator");
    let reset_val = reset_op.call(&x, t);
verdict: keep

### 18  crates/diffsol/src/ode_equations/test_models/exponential_decay.rs:12
# exponential decay problem
# dy/dt = -ay (p = [a, y0])
    fn exponential_decay<M: Matrix>(x: &M::V, p: &M::V, _t: M::T, y: &mut M::V) {
    y.copy_from(x);
    let nbatch = y.context().nbatch();
    for b in 0..nbatch {
verdict: keep

### 19  crates/diffsol/src/ode_equations/test_models/exponential_decay.rs:86
# dy0/dp = | 0 1 |
# | 0 1 |
# dy0/dp v = | 0 1 | |v_1| = |v_2|
# | 0 1 | |v_2|   |v_2|
    fn exponential_decay_init_sens<M: MatrixHost>(_p: &M::V, _t: M::T, v: &M::V, y: &mut M::V) {
    y[0] = v[1];
    y[1] = v[1];
    }
verdict: keep

### 20  crates/diffsol/src/ode_equations/test_models/exponential_decay_with_algebraic.rs:77
# -J^T v = | av[0] |
# | av[1] + v[2] |
# |  -v[2]    |
    fn exponential_decay_with_algebraic_adjoint<M: MatrixHost>(
    _x: &M::V,
    p: &M::V,
    _t: M::T,
verdict: keep

### 21  crates/diffsol/src/ode_equations/test_models/exponential_decay_with_algebraic.rs:698
# check the calc_out adjoint jacobian
    let mut y_check = NalgebraVec::zeros(3, *ctx);
    exponential_decay_with_algebraic_out_jac_adj_mul::<NalgebraMat<f64>>(
    &x,
    &p,
verdict: ?

### 22  crates/diffsol/src/ode_equations/test_models/foodweb.rs:412
#
# Fweb: Rate function for the food-web problem.
# This routine computes the right-hand sides of the system equations,
# consisting of the diffusion term and interaction term.
# The interaction term is computed by the function WebRates.
#
    fn call_inplace(&self, x: &M::V, _t: M::T, mut y: &mut M::V) {
    let nsmx: usize = NUM_SPECIES * NX;
    let dx: f64 = AX / (NX as f64 - 1.0);
    let dy: f64 = AY / (NX as f64 - 1.0);
verdict: ?

### 23  crates/diffsol/src/ode_equations/test_models/foodweb.rs:641
# Loop over all grid points, setting residual values appropriately
# for differential or algebraic components.
    for jy in 0..NX {
    let yloc = nsmx * jy;
    for jx in 0..NX {
    let loc = yloc + NUM_SPECIES * jx;
verdict: ?

### 24  crates/diffsol/src/ode_solver/adjoint.rs:330
# g_p contribution: sg -= -g_p^T * dgdu  =>  sg += g_p^T * dgdu
    out.sens_transpose_mul_inplace(buf.tmp_nstates, t, buf.tmp_nout, buf.tmp_nparams);
    sg_i.sub_assign(&*buf.tmp_nparams);
    out.jac_transpose_mul_inplace(buf.tmp_nstates, t, buf.tmp_nout, buf.tmp_nstates2);
verdict: ?

### 25  crates/diffsol/src/ode_solver/bdf.rs:620
# integrate output function
    if self.ode_problem.integrate_out {
    Self::_predict_using_diff(&mut state.g, &state.gdiff, order);
    state.g.axpy(Eqn::T::one(), &self.g_delta, Eqn::T::one());
    Self::_update_diff(order, &self.g_delta, &mut state.gdiff);
verdict: ?

### 26  crates/diffsol/src/ode_solver/bdf.rs:766
# interpolate solution at time values t* where t-h < t* < t
# definition of the interpolating polynomial can be found on page 7 of [1]
    fn interpolate_from_diff(
    t: Eqn::T,
    diff: &M,
    t1: Eqn::T,
verdict: ?

### 27  crates/diffsol/src/ode_solver/bdf.rs:1486
# similar to the optimal step size factor we calculated above for the current
# order k, we need to calculate the optimal step size factors for orders
    let error_m_norm = if order > 1 {
    self.predict_error_control(order - 1)
    } else {
    Eqn::T::INFINITY
verdict: ?

### 28  crates/diffsol/src/ode_solver/runge_kutta.rs:455
# reinitialise tstop if needed
    if let Some(t_stop) = self.tstop {
    self.set_stop_time(t_stop)?;
    }
    self.is_state_mutated = false;
verdict: ?

### 29  crates/diffsol/src/ode_solver/state.rs:1808
# Build a problem with lambda=0 (dy=0) and root g(x)=x[0], so root derivative
# along flow = dg/dx * f + dg/dt = 1*0 + 0 = 0 => zero denominator.
    let problem = OdeBuilder::<TestMat>::new()
    .p([1.0, -2.0])
    .rhs_sens_implicit(
    |x: &TestVec, _p: &TestVec, _t, y: &mut TestVec| y[0] = 0.0 * x[0],
verdict: ?

### 30  crates/diffsol/src/op/bdf.rs:40
# F(y) = M (y - y0 + psi) - c * f(y) = 0
# M = I
# dg = f(y)
# g - y0 + psi = c * dg
# g - y0 = c * dg - psi
    pub fn integrate_out<M: DenseMatrix<V = Eqn::V, T = Eqn::T>>(
    &self,
    dg: &Eqn::V,
    diff: &M,
verdict: ?

### 31  crates/diffsol/src/op/bdf.rs:331
# F(y) = M (y - y0 + psi) - c * f(y)
# M = |1 0|
# |0 1|
# y = |1|
# |1|
# f(y) = |-0.1|
# |-0.1|
# i.e. F(y) = |1 0| |2.1| - 0.1 * |-0.1| =  |2.11|
# |0 1| |2.2|         |-0.1|    |2.21|
    bdf_callable.call_inplace(&y, t, &mut y_out);
    let y_out_expect = Vcpu::from_vec(vec![2.11, 2.21], *ctx);
    y_out.assert_eq_st(&y_out_expect, 1e-10);
    let v = Vcpu::from_vec(vec![1.0, 1.0], *ctx);
verdict: ?

### 32  crates/diffsol/src/op/init.rs:105
# -M_u du + f(u, v)
# g(t, u, v)
    fn call_inplace(&self, x: &Eqn::V, t: Eqn::T, y: &mut Eqn::V) {
    let mut y0 = self.y0.borrow_mut();
    y0.copy_from_indices(x, &self.algebraic_indices);
verdict: ?

### 33  crates/diffsol/src/op/nonlinear_op.rs:5
# NonLinearOp is a trait that defines a nonlinear operator or function `F` that maps an input vector `x` to an output vector `y`, (i.e. `y = F(x, t)`).
# It extends the [Op] trait with methods for computing the operator and its Jacobian.
    pub trait NonLinearOp: Op {
    fn call_inplace(&self, x: &Self::V, t: Self::T, y: &mut Self::V);
verdict: ?

### 34  crates/diffsol/src/op/sdirk.rs:352
# F(y) = M y -  h f(phi + c * y)
# M = |1 0|
# |0 1|
# y = |1|
# |1|
# f(y) = |-0.1 * y|
# |-0.1 * y|
# i.e. f(phi + c * y) = |-0.1 * (1.1 + 0.1 * 1)| = |-0.12|
# |-0.1 * (1.2 + 0.1 * 1)| = |-0.13|
# i.e. F(y) = |1 0| |1| - |-0.12| =  |1.12|
# |0 1| |1|   |-0.13|    |1.13|
    sdirk_callable.call_inplace(&y, t, &mut y_out);
    let y_out_expect = Vcpu::from_vec(vec![1.12, 1.13], *ctx);
    y_out.assert_eq_st(&y_out_expect, 1e-10);
    let v = Vcpu::from_vec(vec![1.0, 1.0], *ctx);
verdict: ?

### 35  examples/intro-logistic-closures/src/create_solvers_uninit.rs:7
# Create a non-initialised state and manually set the values before
# creating the solver
    let mut state = RkState::new_without_initialise(&problem).unwrap();
    state.as_mut().y[0] = 0.1;
    let _solver = problem.tr_bdf2_solver::<LS>(state);
verdict: ?

### 36  examples/performance-solver-comparison/src/main.rs:46
# ANCHOR: logistic_implicit
    OdeBuilder::<M>::new()
    .rtol(RTOL)
    .atol([ATOL])
    .rhs_implicit(
verdict: ?

### 37  examples/predator-prey-fitting-forward/src/main_llvm.rs:135
# print result
    println!("{}", res);
    let best = res.state().best_param.as_ref().unwrap();
    println!("Best parameter vector: {:?}", best);
    println!("True parameter vector: {:?}", vec![b_true, d_true]);
verdict: slop - not needed

### 38  examples/predator-prey-fitting-forward/src/main_llvm.rs:137
# Best parameter vector
    let best = res.state().best_param.as_ref().unwrap();
    println!("Best parameter vector: {:?}", best);
    println!("True parameter vector: {:?}", vec![b_true, d_true]);
    }
verdict: ?
