12#ifndef SANDALS_LINEAR_SYSTEM_HH
13#define SANDALS_LINEAR_SYSTEM_HH
39 template <
typename Real, Integer N, Integer M = 0>
43 using Pointer = std::shared_ptr<SemiExplicit<Real, N, M>>;
52 Eigen::FullPivLU<MatrixE>
m_lu;
81 return this->
E(t)*x_dot - this->
A(t)*x - this->
b(t);
131 this->m_lu.compute(this->
E(t));
132 SANDALS_ASSERT(this->m_lu.rank() == N,
"Sandals:Linear::f(...): singular mass matrix E(t) detected.");
133 return this->m_lu.solve(this->
A(t)*x + this->
b(t));
151 this->m_lu.compute(this->
E(t));
152 SANDALS_ASSERT(this->m_lu.rank() == N,
"Sandals:Linear::Jf_x(...): singular mass matrix E(t) detected.");
153 return this->m_lu.solve(this->
A(t));
198 template <
typename Real, Integer N, Integer M = 0>
202 using Pointer = std::shared_ptr<LinearWrapper<Real, N, M>>;
338 return this->
m_h(x, t);
356 return this->
m_Jh_x(x, t);
#define SANDALS_ASSERT(COND, MSG)
Definition Sandals.hh:44
Explicit(Type t_type, std::string t_name)
Definition Explicit.hh:55
typename Implicit< Real, N, M >::Type Type
Definition Explicit.hh:47
typename Implicit< Real, N, M >::MatrixJF MatrixJF
Definition Explicit.hh:46
typename Implicit< Real, N, M >::VectorF VectorF
Definition Explicit.hh:45
Eigen::Vector< Real, M > VectorH
Definition Implicit.hh:48
Eigen::Matrix< Real, M, N > MatrixJH
Definition Implicit.hh:49
typename Explicit< Real, N, M >::Type Type
Definition Linear.hh:49
virtual VectorB b(Real const t) const =0
Eigen::FullPivLU< MatrixE > m_lu
Definition Linear.hh:52
typename Explicit< Real, N, M >::VectorF VectorF
Definition Linear.hh:44
virtual MatrixE E(Real const t) const =0
typename Explicit< Real, N, M >::MatrixJF MatrixA
Definition Linear.hh:47
MatrixJF JF_x_dot(VectorF const &, VectorF const &, Real const t) const override
Definition Linear.hh:116
typename Explicit< Real, N, M >::MatrixJF MatrixE
Definition Linear.hh:46
virtual MatrixA A(Real const t) const =0
Linear()
Definition Linear.hh:58
typename Explicit< Real, N, M >::MatrixJF MatrixJF
Definition Linear.hh:45
VectorF F(VectorF const &x, VectorF const &x_dot, Real const t) const override
Definition Linear.hh:79
typename Explicit< Real, N, M >::VectorF VectorB
Definition Linear.hh:48
VectorF f(VectorF const &x, Real const t) const override
Definition Linear.hh:129
std::shared_ptr< SemiExplicit< Real, N, M > > Pointer
Definition Linear.hh:43
MatrixJF Jf_x(VectorF const &, Real const t) const override
Definition Linear.hh:149
Linear(std::string t_name)
Definition Linear.hh:64
MatrixJF JF_x(VectorF const &, VectorF const &, Real const t) const override
Definition Linear.hh:99
LinearWrapper(FunctionE t_E, FunctionA t_A, FunctionB t_b, FunctionH t_h=DefaultH, FunctionJH t_Jh_x=DefaultJH, FunctionID t_in_domain=DefaultID)
Definition Linear.hh:239
MatrixA A(Real const t) const override
Definition Linear.hh:315
FunctionH & h()
Definition Linear.hh:286
MatrixJH Jh_x(VectorF const &x, Real const t) const override
Definition Linear.hh:354
~LinearWrapper()
Definition Linear.hh:262
std::function< VectorB(Real const)> FunctionB
Definition Linear.hh:212
static const FunctionH DefaultH
Definition Linear.hh:217
VectorH h(VectorF const &x, Real const t) const override
Definition Linear.hh:336
std::function< MatrixE(Real const)> FunctionE
Definition Linear.hh:210
VectorB b(Real const t) const override
Definition Linear.hh:325
FunctionH m_h
Definition Linear.hh:225
FunctionB m_b
Definition Linear.hh:224
FunctionID & in_domain()
Definition Linear.hh:298
static const FunctionJH DefaultJH
Definition Linear.hh:218
LinearWrapper(std::string t_name, FunctionE t_E, FunctionA t_A, FunctionB t_b, FunctionH t_h=DefaultH, FunctionJH t_Jh_x=DefaultJH, FunctionID t_in_domain=DefaultID)
Definition Linear.hh:254
FunctionB & b()
Definition Linear.hh:280
FunctionE & E()
Definition Linear.hh:268
FunctionE m_E
Definition Linear.hh:222
FunctionA m_A
Definition Linear.hh:223
FunctionID m_in_domain
Definition Linear.hh:227
static const FunctionID DefaultID
Definition Linear.hh:219
std::function< MatrixJH(VectorF const &, Real const)> FunctionJH
Definition Linear.hh:214
std::function< bool(VectorF const &, Real const)> FunctionID
Definition Linear.hh:215
MatrixE E(Real const t) const override
Definition Linear.hh:305
typename Linear< Real, N, M >::MatrixJF MatrixJF
Definition Linear.hh:204
bool in_domain(VectorF const &x, Real const t) const override
Definition Linear.hh:366
FunctionJH & Jh_x()
Definition Linear.hh:292
typename Linear< Real, N, M >::MatrixJF MatrixA
Definition Linear.hh:206
std::function< MatrixA(Real const)> FunctionA
Definition Linear.hh:211
std::shared_ptr< LinearWrapper< Real, N, M > > Pointer
Definition Linear.hh:202
FunctionA & A()
Definition Linear.hh:274
std::function< VectorH(VectorF const &, Real const)> FunctionH
Definition Linear.hh:213
typename Linear< Real, N, M >::MatrixJF MatrixE
Definition Linear.hh:205
typename Linear< Real, N, M >::VectorF VectorB
Definition Linear.hh:207
FunctionJH m_Jh_x
Definition Linear.hh:226
The namespace for the Sandals library.
Definition Sandals.hh:89