From ee58f2ab396a2db78405359445725f8337967a5e Mon Sep 17 00:00:00 2001 From: Christian Zimmermann Date: Thu, 3 Sep 2020 12:15:51 +0200 Subject: [PATCH] enable high level math functions --- src/include/high_level_operation.cc.h | 13 ++++++++++++- src/include/high_level_operation.h | 9 ++++++++- src/tests/op4_unit_test.cc | 2 +- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/include/high_level_operation.cc.h b/src/include/high_level_operation.cc.h index 155a19a..a9f89a3 100644 --- a/src/include/high_level_operation.cc.h +++ b/src/include/high_level_operation.cc.h @@ -288,6 +288,17 @@ namespace MultiArrayTools return HighLevelOpHolder(std::make_shared>( op ) ); } +#define SP " " +#define regFunc1(fff) template \ + HighLevelOpHolder hl_##fff (const HighLevelOpHolder& in) \ + { return HighLevelOpHolder( std::make_shared,1>> \ + ( std::array>,1>( {in.op()} ) ) ); } \ + +#include "extensions/math.h" +#undef regFunc1 +#undef SP + + /* template HighLevelOpHolder exp(const HighLevelOpHolder& in) { @@ -295,5 +306,5 @@ namespace MultiArrayTools ( std::make_shared,1>> ( std::array>,1>( {in.op()} ) ) ); } - + */ } diff --git a/src/include/high_level_operation.h b/src/include/high_level_operation.h index edf5b28..b7e1e3c 100644 --- a/src/include/high_level_operation.h +++ b/src/include/high_level_operation.h @@ -139,9 +139,16 @@ namespace MultiArrayTools template HighLevelOpHolder mkHLO(const ROP& op); +#define SP " " +#define regFunc1(fff) template \ + HighLevelOpHolder hl_##fff (const HighLevelOpHolder& in); +#include "extensions/math.h" +#undef regFunc1 +#undef SP + /* template HighLevelOpHolder exp(const HighLevelOpHolder& in); - + */ } diff --git a/src/tests/op4_unit_test.cc b/src/tests/op4_unit_test.cc index b12b955..edabc61 100644 --- a/src/tests/op4_unit_test.cc +++ b/src/tests/op4_unit_test.cc @@ -302,7 +302,7 @@ namespace auto hop1 = mkHLO(ma2(i1,di2)); auto hop3 = mkHLO(ma1(i1,di1)); - auto hop2 = exp(hop1); + auto hop2 = hl_exp(hop1); auto hop4 = hop3 * hop2; auto hopr = mkHLO(resx4(i1,di4)); hopr.assign( hop4, mi, ic_1, ic_2 );