various fixes

This commit is contained in:
Christian Zimmermann 2021-02-03 14:30:25 +01:00
parent 867c20959a
commit c608239ced
3 changed files with 23 additions and 5 deletions

View file

@ -8,6 +8,7 @@
#include <cmath>
#include <map>
#include <utility>
#include <type_traits>
#include "base_def.h"
#include "mbase_def.h"
@ -792,16 +793,16 @@ namespace MultiArrayTools
T mVal;
};
template <class Op>
template <typename T, class Op>
inline constexpr bool isVAble()
{
return Op::VABLE;
return Op::VABLE and std::is_same<T,typename Op::value_type>::value;
}
template <class Op1, class Op2, class... Ops>
template <typename T, class Op1, class Op2, class... Ops>
inline constexpr bool isVAble()
{
return Op1::VABLE and isVAble<Op2,Ops...>();
return Op1::VABLE and std::is_same<T,typename Op1::value_type>::value and isVAble<T,Op2,Ops...>();
}
template <typename T, class OpFunction, class... Ops>
@ -816,7 +817,7 @@ namespace MultiArrayTools
static constexpr size_t SIZE = RootSum<Ops...>::SIZE;
static constexpr bool FISSTATIC = OpFunction::FISSTATIC;
static constexpr bool CONT = false;
static constexpr bool VABLE = isVAble<Ops...>();
static constexpr bool VABLE = isVAble<T,Ops...>();
private:
std::tuple<Ops...> mOps;

View file

@ -500,6 +500,20 @@ namespace MultiArrayTools
return out;
}
inline double xsqrt(const double& a)
{
return sqrt(a);
}
inline v256 sqrt(const v256& a)
{
v256 out;
for(int i = 0; i < 4; i++){
out._x[i] = xsqrt(a._x[i]);
}
return out;
}
} // namespace MultiArrayTools
#endif

View file

@ -116,6 +116,7 @@ namespace MultiArrayHelper
public:
//static constexpr size_t SIZE = NN<LTpSize-1>::lsize(std::declval<LTp>());
static constexpr size_t NHLAYER = 10; // some large value
static constexpr size_t SIZE = NN<LTpSize-1>::template LSIZE<LTp>();
static constexpr bool CONT = false;
typedef decltype(NN<LTpSize-1>::rootSteps(mLTp)) ExtType;
@ -248,6 +249,8 @@ namespace MultiArrayHelper
static constexpr size_t VarTpSize = LType::VarTpSize;
public:
static constexpr size_t NHLAYER = 10; // some large value
static constexpr size_t SIZE = LType::SIZE;
static constexpr bool CONT = LType::CONT;
typedef typename LType::ExtType ExtType;