Compiled functions#

#include <heyoka/expression.hpp>

The cfunc class#

template<typename T>
class cfunc#

Compiled function.

This class allows to compile just-in-time symbolic functions defined via the expression system. The type T is the floating-point type which will be used for the numerical evaluation of the function.

A tutorial showcasing the use of this class is available.

using in_1d = mdspan<const T, dextents<std::size_t, 1>>#
using out_1d = mdspan<T, dextents<std::size_t, 1>>#
using in_2d = mdspan<const T, dextents<std::size_t, 2>>#
using out_2d = mdspan<T, dextents<std::size_t, 2>>#

Views over 1D and 2D input/output arrays.

These are convenience typedefs for dynamically-sized 1D and 2D array views. They are used as input and output arguments in the call operators.

cfunc() noexcept#

Default constructor.

The default constructor inits the compiled function in an invalid state in which the only supported operations are copy/move construction/assignment, destruction and the invocation of the is_valid() function.

template<typename ...KwArgs>
explicit cfunc(std::vector<expression> fn, std::vector<expression> vars, const KwArgs&... kw_args)#

Main constructor.

This constructor will create a compiled function for the evaluation of the multivariate symbolic vector function fn. The vars argument is a list of variable expressions representing the order in which the inputs of fn are passed to the call operator during evaluation.

[[nodiscard]] bool is_valid() const noexcept#