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 bb4d8c5641a5b3d633d372674e0a35f857889cd4..53a5f6d68d3153537840c4ff45fe5e5d8b0076b7 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.
|
|
@@ -733,7 +733,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 f60236811eba45c67a9638e90d5101d877ecc2d0..264f0950f293c67d6e6c7e729887090c050e40e2 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 e1a419ca5356660b3c1c27230d1cb2a86977fb65..349a1550235516f9853609b61feded834ef2894b 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.
|