From fbd6758fb4649b146176dbbc2dfe9384c69ef58d Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Mon, 12 Feb 2024 15:23:24 +0100 Subject: Remove old stuff with Eigen --- src/control.cpp.old | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 src/control.cpp.old (limited to 'src/control.cpp.old') diff --git a/src/control.cpp.old b/src/control.cpp.old deleted file mode 100644 index 0e0d641..0000000 --- a/src/control.cpp.old +++ /dev/null @@ -1,46 +0,0 @@ -#include "control.h" - -#include "EigenUnsupported/MatrixFunctions" - -namespace ct -{ - template - template - TimeSeries::TimeSeries(size_t nsamples, T start, T end, const SSModel& ss) - : nsamples(nsamples) - , start(start) , end(end) - , t(nsamples) - , u(ss.u.rows(), nsamples) - , x(ss.x.rows(), nsamples) - , y(ss.y.rows(), nsamples) - {} - - template - void response(SSModel ss, TimeSeries& ts) - { - /* Numerically integrate solution with timestep dt and linear interpolation - * between input samples - */ - using namespace Eigen; - - T dt = (ts.start - ts.end) / ts.nsamples; - Matrix expM = (ss.A * dt).exp(); - Index Ad = expM(seq(0,n), seq(0,n)); - Index Bd1 = expM(seq(0, n), seq(n + m, last)); - Matrix Bd0 = expM(seq(0, n), seq(n, n + m)) - Bd1; - - for (int i = 1; i < ts.nsamples; i++) - ts.x(all, i) = Ad * ts.x(all, i - 1) + Bd0 * ts.u(all, i - 1) + Bd1 * ts.u(all, i); - - ts.y = ss.C * ts.x + ss.D * ts.u; - } - - template - void step(SSModel ss, TimeSeries& ts) - { - ts.u.fill(static_cast(1)); - response(ss, ts); - } -} - -// vim: ts=2 sw=2 noet: -- cgit v1.2.1