2021-06-02 15:36:44 -04:00
|
|
|
#include "FunctionTable.hpp"
|
|
|
|
|
|
|
|
|
|
/********************************************************
|
|
|
|
|
* Random number generation *
|
|
|
|
|
********************************************************/
|
2021-09-02 08:19:54 -04:00
|
|
|
/*template<> char genRand<char>()
|
2021-06-02 15:36:44 -04:00
|
|
|
{
|
|
|
|
|
static std::random_device rd;
|
|
|
|
|
static std::mt19937 gen( rd() );
|
|
|
|
|
static std::uniform_int_distribution<char> dis;
|
|
|
|
|
return dis( gen );
|
|
|
|
|
}
|
|
|
|
|
template<> int8_t genRand<int8_t>()
|
|
|
|
|
{
|
|
|
|
|
static std::random_device rd;
|
|
|
|
|
static std::mt19937 gen( rd() );
|
|
|
|
|
static std::uniform_int_distribution<int8_t> dis;
|
|
|
|
|
return dis( gen );
|
|
|
|
|
}
|
|
|
|
|
template<> uint8_t genRand<uint8_t>()
|
|
|
|
|
{
|
|
|
|
|
static std::random_device rd;
|
|
|
|
|
static std::mt19937 gen( rd() );
|
|
|
|
|
static std::uniform_int_distribution<uint8_t> dis;
|
|
|
|
|
return dis( gen );
|
|
|
|
|
}
|
|
|
|
|
template<> int16_t genRand<int16_t>()
|
|
|
|
|
{
|
|
|
|
|
static std::random_device rd;
|
|
|
|
|
static std::mt19937 gen( rd() );
|
|
|
|
|
static std::uniform_int_distribution<int16_t> dis;
|
|
|
|
|
return dis( gen );
|
|
|
|
|
}
|
|
|
|
|
template<> uint16_t genRand<uint16_t>()
|
|
|
|
|
{
|
|
|
|
|
static std::random_device rd;
|
|
|
|
|
static std::mt19937 gen( rd() );
|
|
|
|
|
static std::uniform_int_distribution<uint16_t> dis;
|
|
|
|
|
return dis( gen );
|
|
|
|
|
}
|
|
|
|
|
template<> int32_t genRand<int32_t>()
|
|
|
|
|
{
|
|
|
|
|
static std::random_device rd;
|
|
|
|
|
static std::mt19937 gen( rd() );
|
|
|
|
|
static std::uniform_int_distribution<int32_t> dis;
|
|
|
|
|
return dis( gen );
|
|
|
|
|
}
|
|
|
|
|
template<> uint32_t genRand<uint32_t>()
|
|
|
|
|
{
|
|
|
|
|
static std::random_device rd;
|
|
|
|
|
static std::mt19937 gen( rd() );
|
|
|
|
|
static std::uniform_int_distribution<uint32_t> dis;
|
|
|
|
|
return dis( gen );
|
|
|
|
|
}
|
|
|
|
|
template<> int64_t genRand<int64_t>()
|
|
|
|
|
{
|
|
|
|
|
static std::random_device rd;
|
|
|
|
|
static std::mt19937 gen( rd() );
|
|
|
|
|
static std::uniform_int_distribution<int64_t> dis;
|
|
|
|
|
return dis( gen );
|
|
|
|
|
}
|
|
|
|
|
template<> uint64_t genRand<uint64_t>()
|
|
|
|
|
{
|
|
|
|
|
static std::random_device rd;
|
|
|
|
|
static std::mt19937 gen( rd() );
|
|
|
|
|
static std::uniform_int_distribution<uint64_t> dis;
|
|
|
|
|
return dis( gen );
|
|
|
|
|
}
|
|
|
|
|
template<> float genRand<float>()
|
|
|
|
|
{
|
|
|
|
|
static std::random_device rd;
|
|
|
|
|
static std::mt19937 gen( rd() );
|
|
|
|
|
static std::uniform_real_distribution<float> dis;
|
|
|
|
|
return dis( gen );
|
|
|
|
|
}
|
|
|
|
|
template<> double genRand<double>()
|
|
|
|
|
{
|
|
|
|
|
static std::random_device rd;
|
|
|
|
|
static std::mt19937 gen( rd() );
|
|
|
|
|
static std::uniform_real_distribution<double> dis;
|
|
|
|
|
return dis( gen );
|
|
|
|
|
}
|
|
|
|
|
template<> long double genRand<long double>()
|
|
|
|
|
{
|
|
|
|
|
static std::random_device rd;
|
|
|
|
|
static std::mt19937 gen( rd() );
|
|
|
|
|
static std::uniform_real_distribution<double> dis;
|
|
|
|
|
return dis( gen );
|
|
|
|
|
}
|
2021-09-02 08:19:54 -04:00
|
|
|
*/
|
2021-06-02 15:36:44 -04:00
|
|
|
|
|
|
|
|
/********************************************************
|
|
|
|
|
* axpy *
|
|
|
|
|
********************************************************/
|
2021-11-08 22:58:37 +01:00
|
|
|
template <>
|
2022-02-09 12:03:08 -05:00
|
|
|
void call_axpy<float>(size_t, const float, const float*, float*) {
|
2021-06-02 15:36:44 -04:00
|
|
|
ERROR("Not finished");
|
|
|
|
|
}
|
2021-11-08 22:58:37 +01:00
|
|
|
template <>
|
2022-02-09 12:03:08 -05:00
|
|
|
void call_axpy<double>(size_t, const double, const double*, double*) {
|
2021-06-02 15:36:44 -04:00
|
|
|
ERROR("Not finished");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/********************************************************
|
|
|
|
|
* Multiply two arrays *
|
|
|
|
|
********************************************************/
|
2021-11-08 22:58:37 +01:00
|
|
|
template <>
|
2022-02-09 12:03:08 -05:00
|
|
|
void call_gemv<double>(size_t, size_t, double, double,
|
|
|
|
|
const double*, const double*, double*) {
|
2021-06-02 15:36:44 -04:00
|
|
|
ERROR("Not finished");
|
|
|
|
|
}
|
2021-11-08 22:58:37 +01:00
|
|
|
template <>
|
2022-02-09 12:03:08 -05:00
|
|
|
void call_gemv<float>(size_t, size_t, float, float,
|
|
|
|
|
const float*, const float*, float*) {
|
2021-06-02 15:36:44 -04:00
|
|
|
ERROR("Not finished");
|
|
|
|
|
}
|
2021-11-08 22:58:37 +01:00
|
|
|
template <>
|
2022-02-09 12:03:08 -05:00
|
|
|
void call_gemm<double>(size_t, size_t, size_t, double, double,
|
|
|
|
|
const double*, const double*, double*) {
|
2021-06-02 15:36:44 -04:00
|
|
|
ERROR("Not finished");
|
|
|
|
|
}
|
2021-11-08 22:58:37 +01:00
|
|
|
template <>
|
2022-02-09 12:03:08 -05:00
|
|
|
void call_gemm<float>(size_t, size_t, size_t, float, float,
|
|
|
|
|
const float*, const float*, float*) {
|
2021-06-02 15:36:44 -04:00
|
|
|
ERROR("Not finished");
|
|
|
|
|
}
|