diff --git a/include/ircd/math/math.h b/include/ircd/math/math.h index 93b45277a..daeca759e 100644 --- a/include/ircd/math/math.h +++ b/include/ircd/math/math.h @@ -15,6 +15,7 @@ #include "inv.h" #include "mean.h" #include "tanh.h" +#include "pow.h" #include "fmma.h" #include "norm.h" @@ -22,4 +23,5 @@ namespace ircd { using math::mean; using math::tanh; + using math::pow; } diff --git a/include/ircd/math/pow.h b/include/ircd/math/pow.h new file mode 100644 index 000000000..894f5da3a --- /dev/null +++ b/include/ircd/math/pow.h @@ -0,0 +1,32 @@ +// Matrix Construct +// +// Copyright (C) Matrix Construct Developers, Authors & Contributors +// Copyright (C) 2016-2021 Jason Volk +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice is present in all copies. The +// full license for this software is available in the LICENSE file. + +#pragma once +#define HAVE_IRCD_MATH_POW_H + +namespace ircd::math +{ + template + typename std::enable_if(), T>::type + pow(T, const E); +} + +template +inline typename std::enable_if(), T>::type +ircd::math::pow(T a, + const E e) +{ + for(uint i(0); i < simd::lanes(); ++i) + a[i] = std::pow(a[i], e); + + return a; +}