1#ifndef FREE_TENSOR_MATH_UTILS
2#define FREE_TENSOR_MATH_UTILS
13 requires std::integral<T>;
14 requires !std::same_as<T, bool>;
23 return res - (rem != 0 && ((rem < 0) != (b < 0)));
29 return res + (rem != 0 && ((rem < 0) == (b < 0)));
34 if ((m > 0 && b < 0) || (m < 0 && b > 0)) {
40template <
class T> T
square(T x) {
return x * x; }
41inline bool square(
bool x) {
return x && x; }
43inline double sigmoid(
double x) {
return 1.0 / (1.0 + std::exp(-x)); }
48inline double realDiv(
double a,
double b) {
return a / b; }
Definition: allocator.h:9
UpperBound ceilDiv(const UpperBound &b, int k)
Definition: bounds.cc:232
T square(T x)
Definition: utils.h:40
auto mod(IntegralExceptBool auto a, IntegralExceptBool auto b)
Definition: utils.h:32
UpperBound floorDiv(const UpperBound &b, int k)
Definition: bounds.cc:214
double sigmoid(double x)
Definition: utils.h:43
double realDiv(double a, double b)
Definition: utils.h:48