Go to the documentation of this file.
10 #include <dynamic-graph/factory.h>
19 "IntegratorForceExact");
44 void dgeev_(
const char* jobvl,
const char* jobvr,
const int*
n,
double*
a,
45 const int* lda,
double* wr,
double* wi,
double* vl,
const int* ldvl,
46 double* vr,
const int* ldvr,
double* work,
const int* lwork,
53 int const n = (int)
a.rows();
58 const int ldvl = (int)vl2.rows();
60 const int ldvr = (int)vr2.rows();
67 vl_real, &ldvl, vr_real, &ldvr, &work_temp, &lwork, &result);
68 if (result != 0)
return result;
70 lwork = (int)work_temp;
73 vl_real, &ldvl, vr_real, &ldvr,
MRAWDATA(work), &lwork, &result);
75 for (
int i = 0; i < n; i++) w[i] = std::complex<double>(wr[
i], wi[
i]);
82 long int SIZE =
M.cols();
84 Eigen::VectorXcd evals(SIZE);
88 const int errCode =
geev(
Y, evals, vl, vr);
91 "Invalid argument to geev",
"");
92 }
else if (errCode > 0) {
94 "No convergence for given matrix",
"");
99 for (
unsigned int i = 0;
i < SIZE; ++
i) {
100 for (
unsigned int j = 0; j < SIZE; ++j) {
103 eig(
i) = evals(
i).real();
104 if (fabsf(
static_cast<float>(evals(
i).
imag())) > 1e-5) {
106 "Error imaginary part not null. ",
107 "(at position %d: %f)",
i, evals(
i).
imag());
115 long int SIZE = MiB.cols();
124 Pinv = Pmib.inverse();
127 Mexp.resize(SIZE, SIZE);
128 for (
unsigned int i = 0;
i < SIZE; ++
i)
129 for (
unsigned int j = 0; j < SIZE; ++j) Pmib(
i, j) *=
exp(eig_mib(j));
132 sotDEBUG(45) <<
"expMiB = " << Mexp;
153 long int nf = force.size(),
nv = friction.cols();
165 sotDEBUG(15) <<
"force = " << force;
167 sotDEBUG(25) <<
"Mi = " << massInverse;
172 MiB = massInverse * friction;
178 sotDEBUG(25) <<
"expMiB = " << MiBexp;
181 Binv = friction.inverse();
191 res.resize(MiBexp.rows());
192 res = MiBexp * v0_bif;
int geev(Matrix &a, Eigen::VectorXcd &w, Matrix &vl2, Matrix &vr2)
int nv(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel)
IntegratorForceExact(const std::string &name)
static void expMatrix(const dynamicgraph::Matrix &MiB, dynamicgraph::Matrix &Mexp)
dg::SignalPtr< dynamicgraph::Matrix, sigtime_t > frictionSIN
Eigen::Matrix< typename ComplexMatrix::RealScalar, ComplexMatrix::RowsAtCompileTime, ComplexMatrix::ColsAtCompileTime, ComplexMatrix::Options > imag(const Eigen::MatrixBase< ComplexMatrix > &complex_mat)
dynamicgraph::Vector & computeVelocityExact(dynamicgraph::Vector &res, const sigtime_t &time)
void dgeev_(const char *jobvl, const char *jobvr, const int *n, double *a, const int *lda, double *wr, double *wi, double *vl, const int *ldvl, double *vr, const int *ldvr, double *work, const int *lwork, int *info)
static void eigenDecomp(const dynamicgraph::Matrix &M, dynamicgraph::Matrix &P, dynamicgraph::Vector &eig)
#define sotDEBUGOUT(level)
#define sotDEBUGIN(level)
virtual void removeDependency(const SignalBase< Time > &signal)
dg::SignalTimeDependent< dynamicgraph::Vector, sigtime_t > velocityDerivativeSOUT
dg::SignalPtr< dynamicgraph::Vector, sigtime_t > velocityPrecSIN
dg::SignalPtr< dynamicgraph::Vector, sigtime_t > forceSIN
dg::SignalPtr< dynamicgraph::Matrix, sigtime_t > massInverseSIN
virtual ~IntegratorForceExact(void)
dg::SignalTimeDependent< dynamicgraph::Vector, sigtime_t > velocitySOUT
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(DoubleConstant, "DoubleConstant")