tinyopt 700
Tinyopt, a lightweight, header only optimization library
Loading...
Searching...
No Matches
c_api_sparse_float.h
1// Copyright 2026 Julien Michot.
2// SPDX-License-Identifier: Apache-2.0
3
4#ifndef TINYOPT_C_C_API_SPARSE_FLOAT_H
5#define TINYOPT_C_C_API_SPARSE_FLOAT_H
6
7#include <tinyopt/c/c_api_float.h>
8
9#if TINYOPT_C_API_ENABLE_SUITESPARSE && TINYOPT_C_API_ENABLE_FLOAT
10
11#include <cholmod.h>
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17/* Float version of tinyopt_sparse_acc_hessian_func_t; `*hessian` must be single precision
18 (CHOLMOD_SINGLE), real and int-indexed. */
19typedef int (*tinyopt_sparse_acc_hessian_funcf_t)(const float *x, int dims, float *cost,
20 float *gradient, cholmod_sparse **hessian,
21 cholmod_common *common, void *user_data);
22
23typedef struct tinyopt_sparse_problemf_t {
24 tinyopt_sparse_acc_hessian_funcf_t acc_hessian; /* Cost, gradient and sparse Hessian callback. */
25 void *user_data; /* User data passed unchanged to the callback. */
26} tinyopt_sparse_problemf_t;
27
28/* Uses Levenberg-Marquardt (or Gauss-Newton) with a SuiteSparse CHOLMOD linear solver. */
29TINYOPT_C_API tinyopt_status_t tinyopt_optimize_sparsef(const tinyopt_paramsf_t *params,
30 const tinyopt_sparse_problemf_t *problem,
31 const tinyopt_options_t *options,
32 tinyopt_summary_t *summary);
33
34#ifdef __cplusplus
35}
36#endif
37
38#endif
39
40#endif
Definition c_api_common.h:79
Definition c_api_common.h:25