Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/marian-nmt/intgemm.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateusz Chudyk <mateuszchudyk@gmail.com>2019-06-25 15:27:14 +0300
committerMateusz Chudyk <mateuszchudyk@gmail.com>2019-06-25 15:27:14 +0300
commit828b4e48bcfffd312023df8a7c0b2e7c43fbd744 (patch)
tree01aa47e4badcd3974955049761d4645b7c911cba
parent9ac27d7de2965fb8129bfc00f27319acfb20cd5a (diff)
Rename constexpr exp to expi
-rw-r--r--utils.h10
-rw-r--r--vec_utils.h14
2 files changed, 12 insertions, 12 deletions
diff --git a/utils.h b/utils.h
index 86d633b..2927693 100644
--- a/utils.h
+++ b/utils.h
@@ -57,16 +57,16 @@ constexpr unsigned long long factorial(unsigned n) {
}
/*
- * e^x
+ * e^n, where n is integer
*/
namespace { // anonymous namespace
-constexpr double exp_nonnegative(unsigned x) {
- return x == 0 ? 1.0 : (x == 1 ? 2.718281828459045 : exp_nonnegative(x / 2) * exp_nonnegative((x + 1) / 2));
+constexpr double expi_nonnegative(unsigned n) {
+ return n == 0 ? 1.0 : (n == 1 ? 2.718281828459045 : expi_nonnegative(n / 2) * expi_nonnegative((n + 1) / 2));
}
} // anonymous namespace
-constexpr double exp(int x) {
- return (x >= 0 ? exp_nonnegative(x) : 1.0 / exp_nonnegative(-x));
+constexpr double expi(int n) {
+ return (n >= 0 ? expi_nonnegative(n) : 1.0 / expi_nonnegative(-n));
}
}
diff --git a/vec_utils.h b/vec_utils.h
index 0d2b298..b46aa90 100644
--- a/vec_utils.h
+++ b/vec_utils.h
@@ -75,13 +75,13 @@ Register exp_approx_taylor(Register x) {
static constexpr int EXP_MIN = -20;
static constexpr int EXP_MAX = 20;
static constexpr float EXP_LOOKUP[EXP_MAX - EXP_MIN + 1] = {
- exp(-20), exp(-19), exp(-18), exp(-17), exp(-16), exp(-15),
- exp(-14), exp(-13), exp(-12), exp(-11), exp(-10), exp(-9),
- exp(-8), exp(-7), exp(-6), exp(-5), exp(-4), exp(-3), exp(-2),
- exp(-1), exp(0), exp(1), exp(2), exp(3), exp(4), exp(5),
- exp(6), exp(7), exp(8), exp(9), exp(10), exp(11), exp(12),
- exp(13), exp(14), exp(15), exp(16), exp(17), exp(18), exp(19),
- exp(20),
+ expi(-20), expi(-19), expi(-18), expi(-17), expi(-16), expi(-15),
+ expi(-14), expi(-13), expi(-12), expi(-11), expi(-10), expi(-9),
+ expi(-8), expi(-7), expi(-6), expi(-5), expi(-4), expi(-3), expi(-2),
+ expi(-1), expi(0), expi(1), expi(2), expi(3), expi(4), expi(5),
+ expi(6), expi(7), expi(8), expi(9), expi(10), expi(11), expi(12),
+ expi(13), expi(14), expi(15), expi(16), expi(17), expi(18), expi(19),
+ expi(20),
};
static const Register dividers[] = {