|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
#pragma once
|
|
|
|
|
#include "types.h"
|
|
|
|
|
#include "gc.h"
|
|
|
|
|
#include <utility>
|
|
|
|
|
#include <limits>
|
|
|
|
|
#include <deque>
|
|
|
|
@ -29,14 +30,19 @@ double avg(const VT<T>& v) {
|
|
|
|
|
return (sum<T>(v) / static_cast<double>(v.size));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT, class Ret>
|
|
|
|
|
void sqrt(const VT<T>& v, Ret& ret) {
|
|
|
|
|
for (uint32_t i = 0; i < v.size; ++i)
|
|
|
|
|
ret[i] = sqrt(v[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT>
|
|
|
|
|
VT<double> sqrt(const VT<T>& v) {
|
|
|
|
|
VT<double> ret(v.size);
|
|
|
|
|
for (uint32_t i = 0; i < v.size; ++i) {
|
|
|
|
|
ret[i] = sqrt(v[i]);
|
|
|
|
|
}
|
|
|
|
|
sqrt(v, ret);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
|
T truncate(const T& v, const uint32_t precision) {
|
|
|
|
|
auto multiplier = pow(10, precision);
|
|
|
|
@ -73,109 +79,153 @@ T min(const VT<T>& v) {
|
|
|
|
|
min_v = min_v < _v ? min_v : _v;
|
|
|
|
|
return min_v;
|
|
|
|
|
}
|
|
|
|
|
template<class T, template<typename ...> class VT>
|
|
|
|
|
decayed_t<VT, T> mins(const VT<T>& arr) {
|
|
|
|
|
|
|
|
|
|
// simplify this using a template std::binary_function<T, T, bool> = std::less;
|
|
|
|
|
template<class T, template<typename ...> class VT, class Ret>
|
|
|
|
|
void mins(const VT<T>& arr, Ret& ret) {
|
|
|
|
|
const uint32_t& len = arr.size;
|
|
|
|
|
std::deque<std::pair<T, uint32_t>> cache;
|
|
|
|
|
decayed_t<VT, T> ret(len);
|
|
|
|
|
T min = std::numeric_limits<T>::max();
|
|
|
|
|
for (int i = 0; i < len; ++i) {
|
|
|
|
|
if (arr[i] < min)
|
|
|
|
|
min = arr[i];
|
|
|
|
|
ret[i] = min;
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT>
|
|
|
|
|
decayed_t<VT, T> maxs(const VT<T>& arr) {
|
|
|
|
|
decayed_t<VT, T> mins(const VT<T>& arr) {
|
|
|
|
|
decayed_t<VT, T> ret(arr.size);
|
|
|
|
|
mins(arr, ret);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT, class Ret>
|
|
|
|
|
void maxs(const VT<T>& arr, Ret& ret) {
|
|
|
|
|
const uint32_t& len = arr.size;
|
|
|
|
|
decayed_t<VT, T> ret(len);
|
|
|
|
|
T max = std::numeric_limits<T>::min();
|
|
|
|
|
for (int i = 0; i < len; ++i) {
|
|
|
|
|
if (arr[i] > max)
|
|
|
|
|
max = arr[i];
|
|
|
|
|
ret[i] = max;
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT>
|
|
|
|
|
decayed_t<VT, T> minw(uint32_t w, const VT<T>& arr) {
|
|
|
|
|
decayed_t<VT, T> maxs(const VT<T>& arr) {
|
|
|
|
|
decayed_t<VT, T> ret(arr.size);
|
|
|
|
|
maxs(arr, ret);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT, class Ret>
|
|
|
|
|
void minw(uint32_t w, const VT<T>& arr, Ret& ret) {
|
|
|
|
|
const uint32_t& len = arr.size;
|
|
|
|
|
decayed_t<VT, T> ret(len);
|
|
|
|
|
std::deque<std::pair<T, uint32_t>> cache;
|
|
|
|
|
for (int i = 0; i < len; ++i) {
|
|
|
|
|
if (!cache.empty() && cache.front().second == i - w) cache.pop_front();
|
|
|
|
|
|
|
|
|
|
while (!cache.empty() && cache.back().first > arr[i]) cache.pop_back();
|
|
|
|
|
cache.push_back({ arr[i], i });
|
|
|
|
|
ret[i] = cache.front().first;
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT>
|
|
|
|
|
decayed_t<VT, T> maxw(uint32_t w, const VT<T>& arr) {
|
|
|
|
|
decayed_t<VT, T> minw(uint32_t w, const VT<T>& arr) {
|
|
|
|
|
decayed_t<VT, T> ret(arr.size);
|
|
|
|
|
minw(w, arr, ret);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT, class Ret>
|
|
|
|
|
void maxw(uint32_t w, const VT<T>& arr, Ret& ret) {
|
|
|
|
|
const uint32_t& len = arr.size;
|
|
|
|
|
decayed_t<VT, T> ret(len);
|
|
|
|
|
std::deque<std::pair<T, uint32_t>> cache;
|
|
|
|
|
for (int i = 0; i < len; ++i) {
|
|
|
|
|
if (!cache.empty() && cache.front().second == i - w) cache.pop_front();
|
|
|
|
|
while (!cache.empty() && cache.back().first > arr[i]) cache.pop_back();
|
|
|
|
|
while (!cache.empty() && cache.back().first < arr[i]) cache.pop_back();
|
|
|
|
|
cache.push_back({ arr[i], i });
|
|
|
|
|
arr[i] = cache.front().first;
|
|
|
|
|
ret[i] = cache.front().first;
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT>
|
|
|
|
|
decayed_t<VT, types::GetFPType<T>> ratiow(uint32_t w, const VT<T>& arr) {
|
|
|
|
|
inline decayed_t<VT, T> maxw(uint32_t w, const VT<T>& arr) {
|
|
|
|
|
decayed_t<VT, T> ret(arr.size);
|
|
|
|
|
maxw(w, arr, ret);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT, class Ret>
|
|
|
|
|
void ratiow(uint32_t w, const VT<T>& arr, Ret& ret) {
|
|
|
|
|
typedef std::decay_t<types::GetFPType<T>> FPType;
|
|
|
|
|
uint32_t len = arr.size;
|
|
|
|
|
if (arr.size <= w)
|
|
|
|
|
len = 1;
|
|
|
|
|
w = w > len ? len : w;
|
|
|
|
|
decayed_t<VT, FPType> ret(arr.size);
|
|
|
|
|
ret[0] = 0;
|
|
|
|
|
for (uint32_t i = 0; i < w; ++i)
|
|
|
|
|
ret[i] = arr[i] / (FPType)arr[0];
|
|
|
|
|
for (uint32_t i = w; i < arr.size; ++i)
|
|
|
|
|
ret[i] = arr[i] / (FPType) arr[i - w];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT>
|
|
|
|
|
inline decayed_t<VT, types::GetFPType<T>> ratiow(uint32_t w, const VT<T>& arr) {
|
|
|
|
|
typedef std::decay_t<types::GetFPType<T>> FPType;
|
|
|
|
|
decayed_t<VT, FPType> ret(arr.size);
|
|
|
|
|
ratiow(w, arr, ret);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT>
|
|
|
|
|
decayed_t<VT, types::GetFPType<T>> ratios(const VT<T>& arr) {
|
|
|
|
|
inline decayed_t<VT, types::GetFPType<T>> ratios(const VT<T>& arr) {
|
|
|
|
|
return ratiow(1, arr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT>
|
|
|
|
|
decayed_t<VT, types::GetLongType<T>> sums(const VT<T>& arr) {
|
|
|
|
|
template<class T, template<typename ...> class VT, class Ret>
|
|
|
|
|
inline void ratios(const VT<T>& arr, Ret& ret) {
|
|
|
|
|
return ratiow(1, arr, ret);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT, class Ret>
|
|
|
|
|
void sums(const VT<T>& arr, Ret& ret) {
|
|
|
|
|
const uint32_t& len = arr.size;
|
|
|
|
|
decayed_t<VT, types::GetLongType<T>> ret(len);
|
|
|
|
|
uint32_t i = 0;
|
|
|
|
|
if (len) ret[i++] = arr[0];
|
|
|
|
|
for (; i < len; ++i)
|
|
|
|
|
ret[i] = ret[i - 1] + arr[i];
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT>
|
|
|
|
|
decayed_t<VT, types::GetFPType<types::GetLongType<T>>> avgs(const VT<T>& arr) {
|
|
|
|
|
inline decayed_t<VT, types::GetLongType<T>> sums(const VT<T>& arr) {
|
|
|
|
|
decayed_t<VT, types::GetLongType<T>> ret(arr.size);
|
|
|
|
|
sums(arr, ret);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT, class Ret>
|
|
|
|
|
void avgs(const VT<T>& arr, Ret& ret) {
|
|
|
|
|
const uint32_t& len = arr.size;
|
|
|
|
|
typedef types::GetFPType<types::GetLongType<T>> FPType;
|
|
|
|
|
decayed_t<VT, FPType> ret(len);
|
|
|
|
|
uint32_t i = 0;
|
|
|
|
|
types::GetLongType<T> s;
|
|
|
|
|
if (len) s = ret[i++] = arr[0];
|
|
|
|
|
for (; i < len; ++i)
|
|
|
|
|
ret[i] = (s += arr[i]) / (FPType)(i + 1);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT>
|
|
|
|
|
decayed_t<VT, types::GetLongType<T>> sumw(uint32_t w, const VT<T>& arr) {
|
|
|
|
|
inline decayed_t<VT, types::GetFPType<types::GetLongType<T>>> avgs(const VT<T>& arr) {
|
|
|
|
|
typedef types::GetFPType<types::GetLongType<T>> FPType;
|
|
|
|
|
decayed_t<VT, FPType> ret(arr.size);
|
|
|
|
|
avgs(arr, ret);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT, class Ret>
|
|
|
|
|
void sumw(uint32_t w, const VT<T>& arr, Ret& ret) {
|
|
|
|
|
const uint32_t& len = arr.size;
|
|
|
|
|
decayed_t<VT, types::GetLongType<T>> ret(len);
|
|
|
|
|
uint32_t i = 0;
|
|
|
|
|
w = w > len ? len : w;
|
|
|
|
|
if (len) ret[i++] = arr[0];
|
|
|
|
@ -183,11 +233,17 @@ decayed_t<VT, types::GetLongType<T>> sumw(uint32_t w, const VT<T>& arr) {
|
|
|
|
|
ret[i] = ret[i - 1] + arr[i];
|
|
|
|
|
for (; i < len; ++i)
|
|
|
|
|
ret[i] = ret[i - 1] + arr[i] - arr[i - w];
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT>
|
|
|
|
|
void avgw(uint32_t w, const VT<T>& arr, decayed_t<vector_type, types::GetFPType<types::GetLongType<T>>>& ret) {
|
|
|
|
|
decayed_t<VT, types::GetLongType<T>> sumw(uint32_t w, const VT<T>& arr) {
|
|
|
|
|
decayed_t<VT, types::GetLongType<T>> ret(arr.size);
|
|
|
|
|
sumw(w, arr, ret);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT, class Ret>
|
|
|
|
|
void avgw(uint32_t w, const VT<T>& arr, Ret& ret) {
|
|
|
|
|
typedef types::GetFPType<types::GetLongType<T>> FPType;
|
|
|
|
|
const uint32_t& len = arr.size;
|
|
|
|
|
uint32_t i = 0;
|
|
|
|
@ -201,26 +257,19 @@ void avgw(uint32_t w, const VT<T>& arr, decayed_t<vector_type, types::GetFPType<
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT>
|
|
|
|
|
decayed_t<VT, types::GetFPType<types::GetLongType<T>>> avgw(uint32_t w, const VT<T>& arr) {
|
|
|
|
|
inline decayed_t<VT, types::GetFPType<types::GetLongType<T>>> avgw(uint32_t w, const VT<T>& arr) {
|
|
|
|
|
typedef types::GetFPType<types::GetLongType<T>> FPType;
|
|
|
|
|
const uint32_t& len = arr.size;
|
|
|
|
|
decayed_t<VT, FPType> ret(len);
|
|
|
|
|
uint32_t i = 0;
|
|
|
|
|
types::GetLongType<T> s{};
|
|
|
|
|
w = w > len ? len : w;
|
|
|
|
|
if (len) s = ret[i++] = arr[0];
|
|
|
|
|
for (; i < w; ++i)
|
|
|
|
|
ret[i] = (s += arr[i]) / (FPType)(i + 1);
|
|
|
|
|
for (; i < len; ++i)
|
|
|
|
|
ret[i] = ret[i - 1] + (arr[i] - arr[i - w]) / (FPType)w;
|
|
|
|
|
avgw(w, arr, ret);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT, bool sd = false>
|
|
|
|
|
decayed_t<VT, types::GetFPType<types::GetLongType<T>>> varw(uint32_t w, const VT<T>& arr) {
|
|
|
|
|
template<class T, template<typename ...> class VT, class Ret, bool sd = false>
|
|
|
|
|
void varw(uint32_t w, const VT<T>& arr,
|
|
|
|
|
Ret& ret) {
|
|
|
|
|
using FPType = types::GetFPType<types::GetLongType<T>>;
|
|
|
|
|
const uint32_t& len = arr.size;
|
|
|
|
|
decayed_t<VT, FPType> ret(len);
|
|
|
|
|
uint32_t i = 0;
|
|
|
|
|
types::GetLongType<T> s{};
|
|
|
|
|
w = w > len ? len : w;
|
|
|
|
@ -252,7 +301,14 @@ decayed_t<VT, types::GetFPType<types::GetLongType<T>>> varw(uint32_t w, const VT
|
|
|
|
|
if constexpr(sd)
|
|
|
|
|
if(i)
|
|
|
|
|
ret[i-1] = sqrt(ret[i-1]);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT, bool sd = false>
|
|
|
|
|
inline decayed_t<VT, types::GetFPType<types::GetLongType<T>>> varw(uint32_t w, const VT<T>& arr) {
|
|
|
|
|
using FPType = types::GetFPType<types::GetLongType<T>>;
|
|
|
|
|
decayed_t<VT, FPType> ret(arr.size);
|
|
|
|
|
varw<T, VT, decayed_t<VT, types::GetFPType<types::GetLongType<T>>>, sd>(w, arr, ret);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -274,11 +330,10 @@ types::GetFPType<types::GetLongType<decays<T>>> var(const VT<T>& arr) {
|
|
|
|
|
return (ssq - s * s / (FPType)(len + 1)) / (FPType)(len + 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT, bool sd = false>
|
|
|
|
|
decayed_t<VT, types::GetFPType<types::GetLongType<T>>> vars(const VT<T>& arr) {
|
|
|
|
|
template<class T, template<typename ...> class VT, class Ret, bool sd = false>
|
|
|
|
|
void vars(const VT<T>& arr, Ret& ret) {
|
|
|
|
|
typedef types::GetFPType<types::GetLongType<T>> FPType;
|
|
|
|
|
const uint32_t& len = arr.size;
|
|
|
|
|
decayed_t<VT, FPType> ret(len);
|
|
|
|
|
uint32_t i = 0;
|
|
|
|
|
types::GetLongType<T> s{};
|
|
|
|
|
FPType MnX{};
|
|
|
|
@ -298,51 +353,88 @@ decayed_t<VT, types::GetFPType<types::GetLongType<T>>> vars(const VT<T>& arr) {
|
|
|
|
|
ret[i] = MnX / (FPType)(i + 1);
|
|
|
|
|
if constexpr(sd) ret[i] = sqrt(ret[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT, bool sd = false>
|
|
|
|
|
inline decayed_t<VT, types::GetFPType<types::GetLongType<T>>> vars(const VT<T>& arr) {
|
|
|
|
|
typedef types::GetFPType<types::GetLongType<T>> FPType;
|
|
|
|
|
decayed_t<VT, FPType> ret(arr.size);
|
|
|
|
|
vars<T, VT, decayed_t<VT, types::GetFPType<types::GetLongType<T>>>, sd>(arr, ret);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT>
|
|
|
|
|
types::GetFPType<types::GetLongType<decays<T>>> stddev(const VT<T>& arr) {
|
|
|
|
|
inline types::GetFPType<types::GetLongType<decays<T>>> stddev(const VT<T>& arr) {
|
|
|
|
|
return sqrt(var(arr));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT>
|
|
|
|
|
decayed_t<VT, types::GetFPType<types::GetLongType<T>>> stddevs(const VT<T>& arr) {
|
|
|
|
|
inline decayed_t<VT, types::GetFPType<types::GetLongType<T>>> stddevs(const VT<T>& arr) {
|
|
|
|
|
return vars<T, VT, true>(arr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT>
|
|
|
|
|
decayed_t<VT, types::GetFPType<types::GetLongType<T>>> stddevw(uint32_t w, const VT<T>& arr) {
|
|
|
|
|
inline decayed_t<VT, types::GetFPType<types::GetLongType<T>>> stddevw(uint32_t w, const VT<T>& arr) {
|
|
|
|
|
return varw<T, VT, true>(w, arr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT, class Ret>
|
|
|
|
|
inline auto stddevs(const VT<T>& arr, Ret& ret) {
|
|
|
|
|
return vars<T, VT, Ret, true>(arr, ret);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT, class Ret>
|
|
|
|
|
inline auto stddevw(uint32_t w, const VT<T>& arr, Ret& ret) {
|
|
|
|
|
return varw<T, VT, Ret, true>(w, arr, ret);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// use getSignedType
|
|
|
|
|
template<class T, template<typename ...> class VT>
|
|
|
|
|
decayed_t<VT, T> deltas(const VT<T>& arr) {
|
|
|
|
|
template<class T, template<typename ...> class VT, class Ret>
|
|
|
|
|
void deltas(const VT<T>& arr, Ret& ret) {
|
|
|
|
|
const uint32_t& len = arr.size;
|
|
|
|
|
decayed_t<VT, T> ret(len);
|
|
|
|
|
uint32_t i = 0;
|
|
|
|
|
if (len) ret[i++] = 0;
|
|
|
|
|
for (; i < len; ++i)
|
|
|
|
|
ret[i] = arr[i] - arr[i - 1];
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT>
|
|
|
|
|
decayed_t<VT, T> prev(const VT<T>& arr) {
|
|
|
|
|
inline decayed_t<VT, T> deltas(const VT<T>& arr) {
|
|
|
|
|
decayed_t<VT, T> ret(arr.size);
|
|
|
|
|
deltas(arr, ret);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT, class Ret>
|
|
|
|
|
void prev(const VT<T>& arr, Ret& ret) {
|
|
|
|
|
const uint32_t& len = arr.size;
|
|
|
|
|
decayed_t<VT, T> ret(len);
|
|
|
|
|
uint32_t i = 0;
|
|
|
|
|
if (len) ret[i++] = arr[0];
|
|
|
|
|
for (; i < len; ++i)
|
|
|
|
|
ret[i] = arr[i - 1];
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT>
|
|
|
|
|
decayed_t<VT, T> aggnext(const VT<T>& arr) {
|
|
|
|
|
inline decayed_t<VT, T> prev(const VT<T>& arr) {
|
|
|
|
|
decayed_t<VT, T> ret(arr.size);
|
|
|
|
|
prev(arr, ret);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT, class Ret>
|
|
|
|
|
void aggnext(const VT<T>& arr, Ret& ret) {
|
|
|
|
|
const uint32_t& len = arr.size;
|
|
|
|
|
decayed_t<VT, T> ret(len);
|
|
|
|
|
uint32_t i = 1;
|
|
|
|
|
for (; i < len; ++i)
|
|
|
|
|
ret[i - 1] = arr[i];
|
|
|
|
|
if (len > 0) ret[len - 1] = arr[len - 1];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T, template<typename ...> class VT>
|
|
|
|
|
inline decayed_t<VT, T> aggnext(const VT<T>& arr) {
|
|
|
|
|
decayed_t<VT, T> ret(arr.size);
|
|
|
|
|
aggnext(arr, ret);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -360,8 +452,6 @@ T first(const VT<T>& arr) {
|
|
|
|
|
return arr[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define __DEFAULT_AGGREGATE_FUNCTION__(NAME, RET) \
|
|
|
|
|
template <class T> constexpr T NAME(const T& v) { return RET; }
|
|
|
|
|
|
|
|
|
|