0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-05 21:38:54 +01:00

ircd::math: Add fallback for vectorized single-precision power of.

This commit is contained in:
Jason Volk 2021-03-16 09:58:59 -07:00
parent 152ea2df0a
commit 74d7747fa3
2 changed files with 34 additions and 0 deletions

View file

@ -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;
}

32
include/ircd/math/pow.h Normal file
View file

@ -0,0 +1,32 @@
// Matrix Construct
//
// Copyright (C) Matrix Construct Developers, Authors & Contributors
// Copyright (C) 2016-2021 Jason Volk <jason@zemos.net>
//
// 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<class T,
class E>
typename std::enable_if<simd::is<T>(), T>::type
pow(T, const E);
}
template<class T,
class E>
inline typename std::enable_if<ircd::simd::is<T>(), T>::type
ircd::math::pow(T a,
const E e)
{
for(uint i(0); i < simd::lanes<T>(); ++i)
a[i] = std::pow(a[i], e);
return a;
}