mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
78 lines
3.2 KiB
Diff
78 lines
3.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Tyler Veness <calcmogul@gmail.com>
|
|
Date: Sun, 16 Jun 2024 12:08:49 -0700
|
|
Subject: [PATCH 2/8] Use wpi::SmallVector
|
|
|
|
---
|
|
include/sleipnir/autodiff/expression.hpp | 4 ++--
|
|
include/sleipnir/autodiff/variable.hpp | 5 ++---
|
|
include/sleipnir/autodiff/variable_matrix.hpp | 4 ++--
|
|
3 files changed, 6 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/include/sleipnir/autodiff/expression.hpp b/include/sleipnir/autodiff/expression.hpp
|
|
index 873e1c27559d92eb1b3a217890ca41bdc65af122..1c5f84d22a0bed70869121acabd527825ba90adb 100644
|
|
--- a/include/sleipnir/autodiff/expression.hpp
|
|
+++ b/include/sleipnir/autodiff/expression.hpp
|
|
@@ -30,7 +30,7 @@ inline constexpr bool USE_POOL_ALLOCATOR = true;
|
|
struct Expression;
|
|
|
|
inline constexpr void inc_ref_count(Expression* expr);
|
|
-inline constexpr void dec_ref_count(Expression* expr);
|
|
+inline void dec_ref_count(Expression* expr);
|
|
|
|
/**
|
|
* Typedef for intrusive shared pointer to Expression.
|
|
@@ -680,7 +680,7 @@ inline constexpr void inc_ref_count(Expression* expr) {
|
|
*
|
|
* @param expr The shared pointer's managed object.
|
|
*/
|
|
-inline constexpr void dec_ref_count(Expression* expr) {
|
|
+inline void dec_ref_count(Expression* expr) {
|
|
// If a deeply nested tree is being deallocated all at once, calling the
|
|
// Expression destructor when expr's refcount reaches zero can cause a stack
|
|
// overflow. Instead, we iterate over its children to decrement their
|
|
diff --git a/include/sleipnir/autodiff/variable.hpp b/include/sleipnir/autodiff/variable.hpp
|
|
index 14eb1d3b95069e143699e1488f3081c4cd9de07c..9f79a82763213dc712cce4c2a322289d57645032 100644
|
|
--- a/include/sleipnir/autodiff/variable.hpp
|
|
+++ b/include/sleipnir/autodiff/variable.hpp
|
|
@@ -47,7 +47,7 @@ class SLEIPNIR_DLLEXPORT Variable {
|
|
/**
|
|
* Constructs an empty Variable.
|
|
*/
|
|
- explicit constexpr Variable(std::nullptr_t) : expr{nullptr} {}
|
|
+ explicit Variable(std::nullptr_t) : expr{nullptr} {}
|
|
|
|
/**
|
|
* Constructs a Variable from a floating point type.
|
|
@@ -77,8 +77,7 @@ class SLEIPNIR_DLLEXPORT Variable {
|
|
*
|
|
* @param expr The autodiff variable.
|
|
*/
|
|
- explicit constexpr Variable(detail::ExpressionPtr&& expr)
|
|
- : expr{std::move(expr)} {}
|
|
+ explicit Variable(detail::ExpressionPtr&& expr) : expr{std::move(expr)} {}
|
|
|
|
/**
|
|
* Assignment operator for double.
|
|
diff --git a/include/sleipnir/autodiff/variable_matrix.hpp b/include/sleipnir/autodiff/variable_matrix.hpp
|
|
index 410f12873cfdf5d0d484653c6c3dac74ed96348a..1c6f9e8dade8bebce7aec18bbb9b5491acb1d977 100644
|
|
--- a/include/sleipnir/autodiff/variable_matrix.hpp
|
|
+++ b/include/sleipnir/autodiff/variable_matrix.hpp
|
|
@@ -1120,14 +1120,14 @@ class SLEIPNIR_DLLEXPORT VariableMatrix {
|
|
*
|
|
* @return Begin iterator.
|
|
*/
|
|
- const_iterator cbegin() const { return const_iterator{m_storage.cbegin()}; }
|
|
+ const_iterator cbegin() const { return const_iterator{m_storage.begin()}; }
|
|
|
|
/**
|
|
* Returns end iterator.
|
|
*
|
|
* @return End iterator.
|
|
*/
|
|
- const_iterator cend() const { return const_iterator{m_storage.cend()}; }
|
|
+ const_iterator cend() const { return const_iterator{m_storage.end()}; }
|
|
|
|
/**
|
|
* Returns number of elements in matrix.
|