mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
There's changes to the diagnostic output and a performance improvement for autodiff setup. I also updated Java's Options docs to more closely match upstream.
46 lines
2.2 KiB
Diff
46 lines
2.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Tyler Veness <calcmogul@gmail.com>
|
|
Date: Sat, 8 Feb 2025 13:42:36 -0800
|
|
Subject: [PATCH 05/10] Replace std::views::zip()
|
|
|
|
---
|
|
include/sleipnir/autodiff/gradient_expression_graph.hpp | 5 ++++-
|
|
include/sleipnir/optimization/problem.hpp | 8 +++++---
|
|
2 files changed, 9 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/include/sleipnir/autodiff/gradient_expression_graph.hpp b/include/sleipnir/autodiff/gradient_expression_graph.hpp
|
|
index 275c30b76d34efe7ee1608cd4eedfa54ab2dc1ec..c0e3c161343175837abcb25fb22da0c611a44799 100644
|
|
--- a/include/sleipnir/autodiff/gradient_expression_graph.hpp
|
|
+++ b/include/sleipnir/autodiff/gradient_expression_graph.hpp
|
|
@@ -161,7 +161,10 @@ class GradientExpressionGraph {
|
|
}
|
|
}
|
|
} else {
|
|
- for (const auto& [col, node] : std::views::zip(m_col_list, m_top_list)) {
|
|
+ for (size_t i = 0; i < m_top_list.size(); ++i) {
|
|
+ const auto& col = m_col_list[i];
|
|
+ const auto& node = m_top_list[i];
|
|
+
|
|
// Append adjoints of wrt to sparse matrix triplets
|
|
if (col != -1 && node->adjoint != Scalar(0)) {
|
|
triplets.emplace_back(row, col, node->adjoint);
|
|
diff --git a/include/sleipnir/optimization/problem.hpp b/include/sleipnir/optimization/problem.hpp
|
|
index 273363db2cf75c84d81f2fef36dcb2094303ee2e..c4a45f7f954c9e028b1c85c45d5034bde284474f 100644
|
|
--- a/include/sleipnir/optimization/problem.hpp
|
|
+++ b/include/sleipnir/optimization/problem.hpp
|
|
@@ -771,9 +771,11 @@ class Problem {
|
|
for (const auto& constraint : constraints) {
|
|
++counts[slp::to_underlying(constraint.type())];
|
|
}
|
|
- for (const auto& [count, name] :
|
|
- std::views::zip(counts, std::array{"empty", "constant", "linear",
|
|
- "quadratic", "nonlinear"})) {
|
|
+ for (size_t i = 0; i < counts.size(); ++i) {
|
|
+ constexpr std::array names{"empty", "constant", "linear",
|
|
+ "quadratic", "nonlinear"};
|
|
+ const auto& count = counts[i];
|
|
+ const auto& name = names[i];
|
|
if (count > 0) {
|
|
slp::println(" ↳ {} {}", count, name);
|
|
}
|