Skip to content

Commit aedddce

Browse files
committed
DMP use std::array
Signed-off-by: James Cherry <cherry@parallaxsw.com>
1 parent fe23c45 commit aedddce

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

dcalc/DmpCeff.cc

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "DmpCeff.hh"
3434

3535
#include <algorithm>
36+
#include <array>
3637
#include <cmath>
3738
#include <optional>
3839
#include <string_view>
@@ -201,13 +202,12 @@ class DmpAlg : public StaState
201202

202203
static constexpr int max_nr_order_ = 3;
203204

204-
double x_[max_nr_order_];
205-
double fvec_[max_nr_order_];
206-
double fjac_storage_[max_nr_order_ * max_nr_order_];
207-
double *fjac_[max_nr_order_];
208-
double scale_[max_nr_order_];
209-
double p_[max_nr_order_];
210-
int index_[max_nr_order_];
205+
std::array<double, max_nr_order_> x_;
206+
std::array<double, max_nr_order_> fvec_;
207+
std::array<std::array<double, max_nr_order_>, max_nr_order_> fjac_;
208+
std::array<double, max_nr_order_> scale_;
209+
std::array<double, max_nr_order_> p_;
210+
std::array<int, max_nr_order_> index_;
211211

212212
// Driver slew used to check load delay.
213213
double drvr_slew_;
@@ -237,9 +237,6 @@ DmpAlg::DmpAlg(int nr_order,
237237
c1_(0.0),
238238
nr_order_(nr_order)
239239
{
240-
for (int i = 0; i < nr_order_; i++)
241-
// Only use the upper left block of the matrix
242-
fjac_[i] = fjac_storage_ + i * max_nr_order_;
243240
}
244241

245242
void

0 commit comments

Comments
 (0)