# Hand-managed. Native routines are registered by cpp11 (src/cpp11.cpp); R stubs
# for the [[cpp11::register]] functions live in R/cpp11.R (generated by
# cpp11::cpp_register()). We export a friendly engine_version() plus the
# low-level sd_* expression/problem primitives.
useDynLib(sparsediff, .registration = TRUE)

export(engine_version)

# problem construction & evaluation
export(sd_problem)
export(sd_init_jacobian)
export(sd_init_derivatives)
export(sd_objective_forward)
export(sd_constraint_forward)
export(sd_gradient)
export(sd_register_params)
export(sd_update_params)

# sparse derivatives (COO)
export(sd_init_jacobian_coo)
export(sd_jacobian_sparsity)
export(sd_jacobian_values)
export(sd_init_hessian_coo)
export(sd_hessian_sparsity)
export(sd_hessian_values)

# leaves
export(sd_variable)

# affine
export(sd_add)
export(sd_neg)
export(sd_sum)
export(sd_trace)
export(sd_transpose)
export(sd_diag_vec)
export(sd_diag_mat)
export(sd_upper_tri)
export(sd_promote)
export(sd_reshape)
export(sd_broadcast)
export(sd_index)
export(sd_hstack)
export(sd_vstack)

# elementwise, full domain
export(sd_exp)
export(sd_sin)
export(sd_cos)
export(sd_sinh)
export(sd_tanh)
export(sd_asinh)
export(sd_logistic)
export(sd_xexp)
export(sd_normal_cdf)
export(sd_power)

# elementwise, restricted domain
export(sd_log)
export(sd_entr)
export(sd_atanh)
export(sd_tan)

# bivariate
export(sd_elementwise_mult)
export(sd_matmul)
export(sd_quad_over_lin)
export(sd_rel_entr)
export(sd_rel_entr_first_scalar)
export(sd_rel_entr_second_scalar)

# non-elementwise
export(sd_prod)
export(sd_prod_axis_zero)
export(sd_prod_axis_one)

# parameters / constants and constant-matrix atoms
export(sd_parameter)
export(sd_scalar_mult)
export(sd_vector_mult)
export(sd_convolve)
export(sd_quad_form)
export(sd_left_matmul)
export(sd_right_matmul)
export(sd_left_matmul_dense)
export(sd_right_matmul_dense)
