8#define ALPAQA_DL_ABI_VERSION 0xA1A000000005
10#ifdef ALPAQA_DL_PROBLEM_EXPORT
12#define ALPAQA_DL_PROBLEM_EXPORT
13#elif defined(__GNUC__)
14#define ALPAQA_DL_PROBLEM_EXPORT __attribute__((visibility("default")))
16#define ALPAQA_DL_PROBLEM_EXPORT
21#define ALPAQA_BEGIN_STRUCT(name) struct name
22#define ALPAQA_END_STRUCT(name)
23#define ALPAQA_DEFAULT(...) \
23#define ALPAQA_DEFAULT(...) \ …
26#define ALPAQA_BEGIN_STRUCT(name) typedef struct
27#define ALPAQA_END_STRUCT(name) name
28#define ALPAQA_DEFAULT(...)
98 alpaqa_sparse_csc_unsorted = 0,
99 alpaqa_sparse_csc_sorted_rows = 1,
112 alpaqa_sparse_csc_l_unsorted = 0,
113 alpaqa_sparse_csc_l_sorted_rows = 1,
126 alpaqa_sparse_csc_ll_unsorted = 0,
127 alpaqa_sparse_csc_ll_sorted_rows = 1,
140 alpaqa_sparse_coo_unsorted = 0,
141 alpaqa_sparse_coo_sorted_by_cols_and_rows = 1,
142 alpaqa_sparse_coo_sorted_by_cols_only = 2,
143 alpaqa_sparse_coo_sorted_by_rows_and_cols = 3,
144 alpaqa_sparse_coo_sorted_by_rows_only = 4,
158 alpaqa_sparse_coo_l_unsorted = 0,
159 alpaqa_sparse_coo_l_sorted_by_cols_and_rows = 1,
160 alpaqa_sparse_coo_l_sorted_by_cols_only = 2,
161 alpaqa_sparse_coo_l_sorted_by_rows_and_cols = 3,
162 alpaqa_sparse_coo_l_sorted_by_rows_only = 4,
176 alpaqa_sparse_coo_ll_unsorted = 0,
177 alpaqa_sparse_coo_ll_sorted_by_cols_and_rows = 1,
178 alpaqa_sparse_coo_ll_sorted_by_cols_only = 2,
179 alpaqa_sparse_coo_ll_sorted_by_rows_and_cols = 3,
180 alpaqa_sparse_coo_ll_sorted_by_rows_only = 4,
229 void (*eval_grad_f)( {
…};
241 void (*eval_grad_g_prod)(
241 void (*eval_grad_g_prod)( {
…};
250 void (*eval_proj_diff_g)(
250 void (*eval_proj_diff_g)( {
…};
256 void (*eval_proj_multipliers)(
283 void (*eval_jac_g)( {
…};
293 void (*eval_grad_gi)(
293 void (*eval_grad_gi)( {
…};
300 void (*eval_hess_L_prod)(
300 void (*eval_hess_L_prod)( {
…};
309 void (*eval_hess_L)( {
…};
321 void (*eval_hess_ψ_prod)(
321 void (*eval_hess_ψ_prod)( {
…};
333 void (*eval_hess_ψ)( {
…};
361 void (*eval_grad_f_grad_g_prod)(
361 void (*eval_grad_f_grad_g_prod)( {
…};
369 void (*eval_grad_L)( {
…};
388 void (*eval_grad_ψ)( {
…};
414 void (*initialize_box_C)(
414 void (*initialize_box_C)( {
…};
420 void (*initialize_box_D)(
420 void (*initialize_box_D)( {
…};
430 void (*initialize_l1_reg)(
430 void (*initialize_l1_reg)( {
…};
480 void (*get_D_N)( {
…};
484 void (*get_x_init)( {
…};
493 void (*eval_jac_f)( {
…};
499 void (*eval_grad_f_prod)(
499 void (*eval_grad_f_prod)( {
…};
512 void (*eval_h_N)( {
…};
523 void (*eval_qr)( {
…};
529 void (*eval_q_N)( {
…};
534 void (*eval_add_Q)( {
…};
540 void (*eval_add_Q_N)(
540 void (*eval_add_Q_N)( {
…};
545 void (*eval_add_R_masked)(
545 void (*eval_add_R_masked)( {
…};
553 void (*eval_add_S_masked)(
553 void (*eval_add_S_masked)( {
…};
561 void (*eval_add_R_prod_masked)(
561 void (*eval_add_R_prod_masked)( {
…};
571 void (*eval_add_S_prod_masked)(
571 void (*eval_add_S_prod_masked)( {
…};
584 void (*eval_constr)( {
…};
589 void (*eval_constr_N)(
589 void (*eval_constr_N)( {
…};
593 void (*eval_grad_constr_prod)(
593 void (*eval_grad_constr_prod)( {
…};
599 void (*eval_grad_constr_prod_N)(
599 void (*eval_grad_constr_prod_N)( {
…};
604 void (*eval_add_gn_hess_constr)(
604 void (*eval_add_gn_hess_constr)( {
…};
610 void (*eval_add_gn_hess_constr_N)(
610 void (*eval_add_gn_hess_constr_N)( {
…};
644#if !defined(__cplusplus) || defined(DOXYGEN)
663#define ALPAQA_PROBLEM_REGISTER_INIT(self) \
665 alpaqa_problem_register_t *: alpaqa_problem_register_init, \
666 alpaqa_control_problem_register_t *: alpaqa_control_problem_register_init)( \
663#define ALPAQA_PROBLEM_REGISTER_INIT(self) \ …
670#if defined(__cplusplus) && \
671 (__cplusplus > 201703L || (defined(_MSVC_LANG) && _MSVC_LANG > 201703L))
680 std::map<std::string, std::any>
dict{};
698template <
class Signature>
702template <
class Signature>
712 if (extra_functions ==
nullptr)
714 extra_functions->
dict.insert_or_assign(
723 std::forward<Func>(func));
730 std::forward<Func>(func));
733template <
class Result,
class T,
class Ret,
class...
Args>
738 auto *self = reinterpret_cast<T *>(self_);
739 return (self->*member)(std::forward<Args>(args)...);
743template <
class Result,
class T,
class Ret,
class...
Args>
748 const auto *self = reinterpret_cast<const T *>(self_);
749 return (self->*member)(std::forward<Args>(args)...);
756template <
auto Member,
class Class,
class Ret,
class...
Args>
759 auto *self =
reinterpret_cast<Class *
>(
self_);
760 return (self->*Member)(std::forward<Args>(
args)...);
765template <
auto Member,
class Class,
class Ret,
class...
Args>
768 requires std::is_void_v<Self>
770 const auto *self =
reinterpret_cast<const Class *
>(
self_);
771 return (self->*Member)(std::forward<Args>(
args)...);
776template <auto Member,
class Class,
class Ret>
779 requires std::is_void_v<Self>
781 using CClass = std::conditional_t<std::is_const_v<Self>,
782 std::add_const_t<Class>,
Class>;
784 return self->*Member;
803template <auto Member>
805 return detail::member_caller<Member>(Member);
816 delete extra_functions;
817 extra_functions =
nullptr;
static void alpaqa_control_problem_register_init(alpaqa_control_problem_register_t *self)
#define ALPAQA_DL_ABI_VERSION
alpaqa_register_arg_type_t
@ alpaqa_register_arg_unspecified
No type was specified (discouraged).
@ alpaqa_register_arg_strings
The alpaqa_register_arg_t::data pointer points to a dynamic C++ std::span of std::string_view.
@ alpaqa_register_arg_std_any
The alpaqa_register_arg_t::data pointer points to a C++ std::any object.
@ alpaqa_register_arg_py_args
The alpaqa_register_arg_t::data pointer points to a C++ tuple of pybind11::args and pybind11::kwargs.
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_END_STRUCT(name)
#define ALPAQA_DEFAULT(...)
alpaqa_length_t alpaqa_index_t
#define ALPAQA_BEGIN_STRUCT(name)
uint64_t alpaqa_dl_abi_version_t
#define ALPAQA_DL_PROBLEM_EXPORT
std::map< std::string, std::any > dict
static void alpaqa_problem_register_init(alpaqa_problem_register_t *self)
User-provided argument that is passed to the problem registration functions.
std::function< Signature > function
Custom type for which we can export the RTTI to support std::any across shared library boundaries whe...
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...
alpaqa_dl_abi_version_t abi_version
To check whether the loaded problem is compatible with the version of the solver.
alpaqa_function_dict_t * extra_functions
Pointer to a map of extra functions (C++ only).
C API providing function pointers to problem functions.
alpaqa_dl_abi_version_t abi_version
To check whether the loaded problem is compatible with the version of the solver.
alpaqa_function_dict_t * extra_functions
Pointer to a map of extra functions (C++ only).
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