arith + hl_ops: negate

This commit is contained in:
Christian Zimmermann 2020-12-07 13:46:01 +01:00
parent e7fd650922
commit ac5b74c57a
2 changed files with 26 additions and 0 deletions

View file

@ -142,6 +142,19 @@ namespace MultiArrayTools
};
template <typename T>
struct negate : public StaticFunctionBase<T, negate<T>, T>
{
static constexpr bool FISSTATIC = true;
using StaticFunctionBase<T, negate<T>, T>::apply;
static inline T apply(T a)
{
return -a;
}
};
template <typename T>
using plus = plusx<T,T>;

View file

@ -33,3 +33,16 @@ for fff in plus minus multiplies divides ; do
echo " template class HighLevelOp<OpD,${fff}x<double,double>,2>;" >> ${file}
echo "}" >> ${file}
done
for fff in negate ; do
file=hl_ops/${fff}.cc
test -f ${file} && rm -f ${file}
echo "#include \"multi_array_header.h\"" >> ${file}
echo "#include \"high_level_operation.h\"" >> ${file}
echo "" >> ${file}
echo "namespace MultiArrayTools" >> ${file}
echo "{" >> ${file}
echo " template class HighLevelOp<OpCD,${fff}<double>,1>;" >> ${file}
echo " template class HighLevelOp<OpD,${fff}<double>,1>;" >> ${file}
echo "}" >> ${file}
done