WPILibC++ 2027.0.0-alpha-2
Loading...
Searching...
No Matches
expression_type.hpp
Go to the documentation of this file.
1// Copyright (c) Sleipnir contributors
2
3#pragma once
4
5#include <stdint.h>
6
7#include <string_view>
8
10
11namespace slp {
12
13/**
14 * Expression type.
15 *
16 * Used for autodiff caching.
17 */
18enum class ExpressionType : uint8_t {
19 /// There is no expression.
20 NONE,
21 /// The expression is a constant.
23 /// The expression is composed of linear and lower-order operators.
24 LINEAR,
25 /// The expression is composed of quadratic and lower-order operators.
27 /// The expression is composed of nonlinear and lower-order operators.
29};
30
31/**
32 * Returns user-readable message corresponding to the expression type.
33 *
34 * @param type Expression type.
35 */
36SLEIPNIR_DLLEXPORT constexpr std::string_view to_message(
37 const ExpressionType& type) {
38 using enum ExpressionType;
39
40 switch (type) {
41 case NONE:
42 return "none";
43 case CONSTANT:
44 return "constant";
45 case LINEAR:
46 return "linear";
47 case QUADRATIC:
48 return "quadratic";
49 case NONLINEAR:
50 return "nonlinear";
51 default:
52 return "unknown";
53 }
54}
55
56} // namespace slp
Definition expression_graph.hpp:11
ExpressionType
Expression type.
Definition expression_type.hpp:18
@ CONSTANT
The expression is a constant.
@ QUADRATIC
The expression is composed of quadratic and lower-order operators.
@ LINEAR
The expression is composed of linear and lower-order operators.
@ NONE
There is no expression.
@ NONLINEAR
The expression is composed of nonlinear and lower-order operators.
SLEIPNIR_DLLEXPORT constexpr std::string_view to_message(const ExitStatus &exit_status)
Returns user-readable message corresponding to the solver exit status.
Definition exit_status.hpp:50
#define SLEIPNIR_DLLEXPORT
Definition symbol_exports.hpp:34