9#define ALPAQA_DL_ABI_VERSION 0xA1A000000002
13#define ALPAQA_DEFAULT(...) \
16#define ALPAQA_DEFAULT(...)
45 alpaqa_sparse_csc_unsorted = 0,
46 alpaqa_sparse_csc_sorted_rows = 1,
59 alpaqa_sparse_csc_l_unsorted = 0,
60 alpaqa_sparse_csc_l_sorted_rows = 1,
73 alpaqa_sparse_csc_ll_unsorted = 0,
74 alpaqa_sparse_csc_ll_sorted_rows = 1,
87 alpaqa_sparse_coo_unsorted = 0,
88 alpaqa_sparse_coo_sorted_by_cols_and_rows = 1,
89 alpaqa_sparse_coo_sorted_by_cols_only = 2,
90 alpaqa_sparse_coo_sorted_by_rows_and_cols = 3,
91 alpaqa_sparse_coo_sorted_by_rows_only = 4,
105 alpaqa_sparse_coo_l_unsorted = 0,
106 alpaqa_sparse_coo_l_sorted_by_cols_and_rows = 1,
107 alpaqa_sparse_coo_l_sorted_by_cols_only = 2,
108 alpaqa_sparse_coo_l_sorted_by_rows_and_cols = 3,
109 alpaqa_sparse_coo_l_sorted_by_rows_only = 4,
123 alpaqa_sparse_coo_ll_unsorted = 0,
124 alpaqa_sparse_coo_ll_sorted_by_cols_and_rows = 1,
125 alpaqa_sparse_coo_ll_sorted_by_cols_only = 2,
126 alpaqa_sparse_coo_ll_sorted_by_rows_and_cols = 3,
127 alpaqa_sparse_coo_ll_sorted_by_rows_only = 4,
185 void (*eval_grad_g_prod)(
202 void (*eval_grad_gi)(
209 void (*eval_hess_L_prod)(
230 void (*eval_hess_ψ_prod)(
269 void (*eval_grad_f_grad_g_prod)(
331 void (*initialize_box_C)(
337 void (*initialize_box_D)(
347 void (*initialize_l1_reg)(
414 void (*eval_grad_f_prod)(
455 void (*eval_add_Q_N)(
460 void (*eval_add_R_masked)(
468 void (*eval_add_S_masked)(
476 void (*eval_add_R_prod_masked)(
486 void (*eval_add_S_prod_masked)(
504 void (*eval_constr_N)(
508 void (*eval_grad_constr_prod)(
514 void (*eval_grad_constr_prod_N)(
519 void (*eval_add_gn_hess_constr)(
525 void (*eval_add_gn_hess_constr_N)(
557#if !defined(__cplusplus) || defined(DOXYGEN)
576#define ALPAQA_PROBLEM_REGISTER_INIT(self) \
578 alpaqa_problem_register_t *: alpaqa_problem_register_init, \
579 alpaqa_control_problem_register_t *: alpaqa_control_problem_register_init)( \
583#if defined(__cplusplus) && __cplusplus > 201703L
592 std::map<std::string, std::any>
dict{};
613 if (extra_functions ==
nullptr)
615 extra_functions->
dict.insert_or_assign(
616 std::move(name), std::function{std::forward<Func>(
func)});
623 std::forward<Func>(
func));
630 std::forward<Func>(
func));
638 auto *self = reinterpret_cast<T *>(self_);
639 return (self->*member)(std::forward<Args>(args)...);
648 const auto *self = reinterpret_cast<const T *>(self_);
649 return (self->*member)(std::forward<Args>(args)...);
659 auto *self =
reinterpret_cast<Class *
>(
self_);
660 return (self->*
Member)(std::forward<Args>(
args)...);
668 requires std::is_void_v<Self>
670 const auto *self =
reinterpret_cast<const Class *
>(
self_);
671 return (self->*
Member)(std::forward<Args>(
args)...);
676template <auto Member,
class Class,
class Ret>
679 requires std::is_void_v<Self>
681 using CClass = std::conditional_t<std::is_const_v<Self>,
682 std::add_const_t<Class>,
Class>;
703template <auto Member>
705 return detail::member_caller<Member>(
Member);
716 delete extra_functions;
717 extra_functions =
nullptr;
static void alpaqa_control_problem_register_init(alpaqa_control_problem_register_t *self)
#define ALPAQA_DL_ABI_VERSION
struct alpaqa_function_dict_s alpaqa_function_dict_t
Opaque type for a C++-only map of extra functions.
ptrdiff_t alpaqa_length_t
#define ALPAQA_DEFAULT(...)
alpaqa_length_t alpaqa_index_t
std::map< std::string, std::any > dict
static void alpaqa_problem_register_init(alpaqa_problem_register_t *self)
void unregister_functions(function_dict_t *&extra_functions)
Cleans up the extra functions registered by register_function.
void register_function(function_dict_t *&extra_functions, std::string name, Func &&func)
Make the given function available to alpaqa.
void register_member_function(Result &result, std::string name, Ret(T::*member)(Args...))
static auto member_caller()
Wrap the given member function or variable into a (possibly generic) lambda function that accepts the...
uint64_t abi_version
To check whether the loaded problem is compatible with the version of the solver.
C API providing function pointers to problem functions.
uint64_t abi_version
To check whether the loaded problem is compatible with the version of the solver.
const long long * row_indices
const long long * col_indices
const long long * inner_idx
const long long * outer_ptr
@ alpaqa_sparsity_sparse_csc
@ alpaqa_sparsity_sparse_coo_l
@ alpaqa_sparsity_sparse_coo_ll
@ alpaqa_sparsity_sparse_csc_ll
@ alpaqa_sparsity_sparse_csc_l
@ alpaqa_sparsity_sparse_coo