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 <cmath>
#include <map> #include <map>
#include <utility> #include <utility>
#include <type_traits>
#include "base_def.h" #include "base_def.h"
#include "mbase_def.h" #include "mbase_def.h"
@ -792,16 +793,16 @@ namespace MultiArrayTools
T mVal; T mVal;
}; };
template <class Op> template <typename T, class Op>
inline constexpr bool isVAble() 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() 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> template <typename T, class OpFunction, class... Ops>
@ -816,7 +817,7 @@ namespace MultiArrayTools
static constexpr size_t SIZE = RootSum<Ops...>::SIZE; static constexpr size_t SIZE = RootSum<Ops...>::SIZE;
static constexpr bool FISSTATIC = OpFunction::FISSTATIC; static constexpr bool FISSTATIC = OpFunction::FISSTATIC;
static constexpr bool CONT = false; static constexpr bool CONT = false;
static constexpr bool VABLE = isVAble<Ops...>(); static constexpr bool VABLE = isVAble<T,Ops...>();
private: private:
std::tuple<Ops...> mOps; std::tuple<Ops...> mOps;

View file

@ -500,6 +500,20 @@ namespace MultiArrayTools
return out; 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 } // namespace MultiArrayTools
#endif #endif

View file

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