3#ifndef cMHN_TT_MHN_OPERATOR_H
4#define cMHN_TT_MHN_OPERATOR_H
21 template<
class T, pRC::Size D>
33 constexpr auto &
theta(pRC::Index
const i, pRC::Index
const j)
const
50 constexpr auto term(pRC::Index
const i)
const
53 pRC::range<pRC::Context::CompileTime, D>(
54 [
this, &ret, i](
auto const j)
56 ret.template core<j>() = this->
core(i, j);
63 template<pRC::Index i>
64 constexpr auto core()
const
66 return expand(pRC::makeSeries<pRC::Index, D>(),
67 [&](
auto const... seq)
69 return (pRC::identity<TermType>() - (
term(seq) + ...))
76 constexpr auto derivative(pRC::Index
const i, pRC::Index
const j)
const
79 pRC::range<pRC::Context::CompileTime, D>(
80 [
this, &ret, i, j](
auto const m)
82 ret.template core<m>() = this->
derivative(i, j, m);
89 template<pRC::Index... Ms, pRC::Index... Ns, pRC::Index... Rs>
90 static constexpr auto termType(pRC::Sequence<pRC::Index, Ms...>
const,
91 pRC::Sequence<pRC::Index, Ns...>
const,
92 pRC::Sequence<pRC::Index, Rs...>
const)
94 using M = pRC::Sizes<Ms...>;
95 using N = pRC::Sizes<Ns...>;
96 using R = pRC::Sizes<Rs...>;
98 return pRC::TensorTrain::Operator<T, M, N, R>();
102 decltype(termType(pRC::makeConstantSequence<pRC::Index, D, 2>(),
103 pRC::makeConstantSequence<pRC::Index, D, 2>(),
104 pRC::makeConstantSequence<pRC::Index, D - 1, 1>()));
108 constexpr auto core(pRC::Size
const i, pRC::Size
const j)
const
110 pRC::Tensor c = pRC::zero<pRC::Tensor<T, 1, 2, 2, 1>>();
113 c(0, 0, 0, 0) = -mTheta(i, i);
114 c(0, 1, 0, 0) = mTheta(i, i);
118 c(0, 0, 0, 0) = pRC::identity<T>();
119 c(0, 1, 1, 0) = mTheta(i, j);
124 constexpr auto derivative(pRC::Size
const i, pRC::Size
const j,
125 pRC::Size
const m)
const
127 pRC::Tensor c = pRC::zero<pRC::Tensor<T, 1, 2, 2, 1>>();
132 c(0, 0, 0, 0) = mTheta(i, m);
133 c(0, 1, 0, 0) = -mTheta(i, m);
137 c(0, 1, 1, 0) = mTheta(i, m);
144 c(0, 0, 0, 0) = mTheta(i, m);
145 c(0, 1, 0, 0) = -mTheta(i, m);
149 c(0, 0, 0, 0) = pRC::identity<T>();
150 c(0, 1, 1, 0) = mTheta(i, m);
158 pRC::Tensor<T, D, D> mTheta;
Class storing an MHN operator represented by a theta matrix (for TT calculations)
Definition: mhn_operator.hpp:23
constexpr auto & theta() const
Definition: mhn_operator.hpp:38
auto & theta()
Definition: mhn_operator.hpp:43
constexpr auto term(pRC::Index const i) const
Definition: mhn_operator.hpp:50
constexpr auto & theta(pRC::Index const i, pRC::Index const j) const
Definition: mhn_operator.hpp:33
constexpr MHNOperator(pRC::Tensor< T, D, D > const &theta)
Definition: mhn_operator.hpp:28
T Type
Definition: mhn_operator.hpp:25
constexpr auto derivative(pRC::Index const i, pRC::Index const j) const
Definition: mhn_operator.hpp:76
constexpr auto core() const
Definition: mhn_operator.hpp:64
pRC::Float<> T
Definition: externs_nonTT.hpp:1