From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Tyler Veness 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 | 4 ++-- include/sleipnir/autodiff/variable_matrix.hpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/sleipnir/autodiff/expression.hpp b/include/sleipnir/autodiff/expression.hpp index f5919de6c9c0be044335ce7764ded545215f0486..46814576a3db9f472329b880b94b1ab98d218867 100644 --- a/include/sleipnir/autodiff/expression.hpp +++ b/include/sleipnir/autodiff/expression.hpp @@ -33,7 +33,7 @@ struct Expression; template constexpr void inc_ref_count(Expression* expr); template -constexpr void dec_ref_count(Expression* expr); +void dec_ref_count(Expression* expr); /** * Typedef for intrusive shared pointer to Expression. @@ -801,7 +801,7 @@ constexpr void inc_ref_count(Expression* expr) { * @param expr The shared pointer's managed object. */ template -constexpr void dec_ref_count(Expression* expr) { +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 c78af7224b2ef93ad50b238117583e01940c53ce..0a55b906130d7506c80eb150644ac44c222d1368 100644 --- a/include/sleipnir/autodiff/variable.hpp +++ b/include/sleipnir/autodiff/variable.hpp @@ -61,7 +61,7 @@ class Variable : public SleipnirBase { /** * Constructs an empty Variable. */ - explicit constexpr Variable(std::nullptr_t) : expr{nullptr} {} + explicit Variable(std::nullptr_t) : expr{nullptr} {} /** * Constructs a Variable from a scalar type. @@ -116,7 +116,7 @@ class Variable : public SleipnirBase { * * @param expr The autodiff variable. */ - explicit constexpr Variable(detail::ExpressionPtr&& expr) + explicit Variable(detail::ExpressionPtr&& expr) : expr{std::move(expr)} {} /** diff --git a/include/sleipnir/autodiff/variable_matrix.hpp b/include/sleipnir/autodiff/variable_matrix.hpp index bb66bebc01413a291242886366ce329bb5f4b70a..7ddf02c0e2f66aff8da422b874cbe9772f9fd00d 100644 --- a/include/sleipnir/autodiff/variable_matrix.hpp +++ b/include/sleipnir/autodiff/variable_matrix.hpp @@ -1281,14 +1281,14 @@ class VariableMatrix : public SleipnirBase { * * @return Const begin iterator. */ - const_iterator cbegin() const { return const_iterator{m_storage.cbegin()}; } + const_iterator cbegin() const { return const_iterator{m_storage.begin()}; } /** * Returns const end iterator. * * @return Const end iterator. */ - const_iterator cend() const { return const_iterator{m_storage.cend()}; } + const_iterator cend() const { return const_iterator{m_storage.end()}; } /** * Returns reverse begin iterator.