48 lines
1.4 KiB
C++
48 lines
1.4 KiB
C++
#ifndef __AMSMATHUTIL25_UTIL_HPP__
|
|
#define __AMSMATHUTIL25_UTIL_HPP__
|
|
|
|
namespace ams
|
|
{
|
|
|
|
//A template function that takes as input a function pointer and a series of arguments
|
|
//The function is executed with fptr(threadnum, nthreads, otherargs...) with a certain number of threads
|
|
//psize must be supplied to determine whether to execute in threaded mode or not.
|
|
template<typename callable, typename ... argst> int threaded_execute(callable &&fptr, int64_t psize, argst&&... args);
|
|
|
|
|
|
//A template function that takes as input a function pointer and a series of arguments
|
|
//The function is executed with fptr(threadnum, nthreads, otherargs...) with a given number of threads
|
|
template<typename callable, typename ... argst> int numthreaded_execute(callable &&fptr, int nthreads, argst&&... args);
|
|
|
|
|
|
template<typename T1, typename T2> struct pair
|
|
{
|
|
public:
|
|
T1 a;
|
|
T2 b;
|
|
pair() {a = T1(); b = T2();}
|
|
pair(const T1 &_a, const T2& _b) {a = _a; b = _b;}
|
|
};
|
|
|
|
template<typename T1, typename T2, typename T3> struct triple
|
|
{
|
|
public:
|
|
T1 a;
|
|
T2 b;
|
|
T3 c;
|
|
triple() {a = T1(); b = T2(); c = T3();}
|
|
triple(const T1 &_a, const T2& _b, const T3& _c) {a = _a; b = _b; c = _c;}
|
|
};
|
|
|
|
//returns time in msec
|
|
double time_msec();
|
|
|
|
}; //end namespace ams
|
|
|
|
#include <amsmathutil25/util/amsmathutil25_utilimpl.hpp>
|
|
#include <amsmathutil25/util/amsmathutil25_bufferops.hpp>
|
|
#include <amsmathutil25/util/amsmathutil25_amsarray.hpp>
|
|
|
|
#endif
|
|
|