Commit 54c91841 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

missing file added

parent 98c0ebbe
......@@ -5,6 +5,7 @@ install(FILES
Basic.hpp
CMath.hpp
Composer.hpp
Composer.impl.hpp
FieldMatVec.hpp
MaxMin.hpp
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/amdis/operations)
#pragma once
#include <amdis/operations/Composer.hpp>
#include <amdis/operations/Arithmetic.hpp>
namespace AMDiS { namespace Operation {
/// Partial derivative of composed function:
/// Implements: // sum_i [ d_i(f)[g...] * d_j(g_i) ]
template <int J, class F, class... Gs>
auto partial(Composer<F,Gs...> const& c, index_t<J> _j)
{
auto index_seq = MakeSeq_t<sizeof...(Gs)>{};
// d_i(f)[g...] * d_j(g_i)
auto term_i = [&](auto const _i)
{
auto di_f = Dune::Std::apply([&](auto const&... gs) {
return compose(partial(c.f_, _i), gs...);
}, c.gs_);
auto const& g_i = std::get<_i>(c.gs_);
return compose(Multiplies{}, di_f, partial(g_i, _j));
};
// sum_i [ d_i(f)[g...] * d_j(g_i) ]
return Dune::Std::apply([&](auto const... _i)
{
return compose(Plus{}, term_i(_i)...);
}, index_seq);
}
}} // end namespace AMDiS::Operation
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment