Skip to content

Commit

Permalink
[SymForce] Use range-based for instead of index-based
Browse files Browse the repository at this point in the history
Topic: chaoqu_symforce_range_for
GitOrigin-RevId: f6de76de4181c990092912d0522b674d882ba01d
  • Loading branch information
chao-qu-skydio authored and aaron-skydio committed Apr 21, 2023
1 parent 07a53fd commit 82d3a1a
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions symforce/opt/linearizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,7 @@ void Linearizer<ScalarType>::BuildInitialLinearization(const Values<Scalar>& val
}

// Add contribution from right-hand-side
for (int key_i = 0; key_i < static_cast<int>(factor_helper.key_helpers.size()); ++key_i) {
const linearization_offsets_t& key_helper = factor_helper.key_helpers[key_i];

for (const linearization_offsets_t& key_helper : factor_helper.key_helpers) {
init_linearization_.rhs.segment(key_helper.combined_offset, key_helper.tangent_dim) +=
linearized_factor.rhs.segment(key_helper.factor_offset, key_helper.tangent_dim);
}
Expand Down Expand Up @@ -224,9 +222,7 @@ void Linearizer<ScalarType>::BuildInitialLinearization(const Values<Scalar>& val
}

// Add contributions from right-hand-side
for (int key_i = 0; key_i < static_cast<int>(factor_helper.key_helpers.size()); ++key_i) {
const linearization_dense_key_helper_t& key_helper = factor_helper.key_helpers[key_i];

for (const linearization_dense_key_helper_t& key_helper : factor_helper.key_helpers) {
init_linearization_.rhs.segment(key_helper.combined_offset, key_helper.tangent_dim) +=
linearized_dense_factor.rhs.segment(key_helper.factor_offset, key_helper.tangent_dim);
}
Expand Down

0 comments on commit 82d3a1a

Please sign in to comment.