21 #ifndef RFFGEN_LINEAR_ALGEBRA_SHIFTED_INVARIANT_HH
22 #define RFFGEN_LINEAR_ALGEBRA_SHIFTED_INVARIANT_HH
24 #include <type_traits>
26 #include "../constant.hh"
27 #include "../Util/base.hh"
28 #include "../Util/derivativeWrappers.hh"
29 #include "../Util/evaluateIfPresent.hh"
30 #include "../Util/indexedType.hh"
34 namespace LinearAlgebra
42 template <
class Invariant,
int offset>
51 template <
class Matrix>
61 template <
class Matrix>
71 template <
class Matrix>
76 template <
class Matrix>
80 resultOfD0 = inv.d0() - offset;
84 auto d0() const noexcept
94 template <
int id ,
class Arg ,
95 class IndexedArg = IndexedType<Arg,id> ,
96 class = std::enable_if_t<EvaluateIfPresent< D1<Invariant,IndexedArg> >::present> >
97 auto d1(
const Arg& dA1)
const
99 return EvaluateIfPresent< D1<Invariant,IndexedArg> > ( inv, dA1 )();
108 template <
int idx,
int idy,
class ArgX ,
class ArgY ,
109 class IndexedArgX = IndexedType<ArgX,idx> ,
110 class IndexedArgY = IndexedType<ArgY,idx> ,
111 class = std::enable_if_t<EvaluateIfPresent< D2<Invariant,IndexedArgX,IndexedArgY> >::present> >
112 auto d2(
const ArgX& dA1,
const ArgY& dA2)
const
114 return EvaluateIfPresent< D2<Invariant,IndexedArgX,IndexedArgY> >(inv,dA1,dA2)();
124 template <
int idx ,
int idy ,
int idz ,
class ArgX ,
class ArgY ,
class ArgZ ,
125 class IndexedArgX = IndexedType<ArgX,idx> ,
126 class IndexedArgY = IndexedType<ArgY,idy> ,
127 class IndexedArgZ = IndexedType<ArgZ,idz> ,
128 class = std::enable_if_t< EvaluateIfPresent< D3<Invariant,IndexedArgX,IndexedArgY,IndexedArgZ> >::present > >
129 auto d3(ArgX
const& dA1, ArgY
const& dA2, ArgZ
const& dA3)
const
131 return EvaluateIfPresent< D3<Invariant,IndexedArgX,IndexedArgY,IndexedArgZ> >(inv,dA1,dA2,dA3)();
136 std::remove_const_t<std::remove_reference_t<decltype(std::declval<Invariant>().
d0())> > resultOfD0 = 0.;
141 #endif // RFFGEN_LINEAR_ALGEBRA_SHIFTED_INVARIANT_HH
ShiftedInvariant(Matrix const &A)
Definition: shiftedInvariant.hh:52
void update(Matrix const &A)
Reset matrix to compute shifted invariant from.
Definition: shiftedInvariant.hh:77
auto d0() const noexcept
Value of the shifted invariant.
Definition: shiftedInvariant.hh:84
auto d1(const Arg &dA1) const
First directional derivative of the (scaled) shifted invariant.
Definition: shiftedInvariant.hh:97
Base class for functions satisfying FunctionConcept. Required for enabling the operators in generate...
Definition: base.hh:27
Possibly scaled, shifted invariant , where for the first two (principal,modified) invariants and fo...
Definition: shiftedInvariant.hh:43
auto d2(const ArgX &dA1, const ArgY &dA2) const
Second directional derivative of the (scaled) shifted invariant.
Definition: shiftedInvariant.hh:112
auto d3(ArgX const &dA1, ArgY const &dA2, ArgZ const &dA3) const
Third directional derivative of the (scaled) shifted invariant.
Definition: shiftedInvariant.hh:129
Wrap a constant.
Definition: constant.hh:41
Invariant
Enum to statically choose invariant traits.
Definition: invariants.hh:37
ShiftedInvariant(const Matrix &A, const Constant< Matrix > &M)
Definition: shiftedInvariant.hh:62
ShiftedInvariant(const Matrix &A, const Matrix &M)
Definition: shiftedInvariant.hh:72