[mlpack-git] master: use constexpr to replace static const (63be94e)

gitdub at mlpack.org gitdub at mlpack.org
Tue Apr 12 07:01:18 EDT 2016


Repository : https://github.com/mlpack/mlpack
On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/78f6ac2e036f659c81be032ebbec55b98fe7461f...eeba6bdc50ad4d785cb6880edbaba78173036ca6

>---------------------------------------------------------------

commit 63be94ebfa7a534d15dc428ac67e386bae4e7cdc
Author: stereomatchingkiss <stereomatchingkiss at gmail.com>
Date:   Tue Apr 12 19:01:18 2016 +0800

    use constexpr to replace static const


>---------------------------------------------------------------

63be94ebfa7a534d15dc428ac67e386bae4e7cdc
 src/mlpack/methods/ann/layer/log_softmax_layer.hpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/mlpack/methods/ann/layer/log_softmax_layer.hpp b/src/mlpack/methods/ann/layer/log_softmax_layer.hpp
index de911a1..46414c0 100644
--- a/src/mlpack/methods/ann/layer/log_softmax_layer.hpp
+++ b/src/mlpack/methods/ann/layer/log_softmax_layer.hpp
@@ -54,11 +54,11 @@ class LogSoftmaxLayer
     output.transform( [](double x)
     {
       //! Fast approximation of exp(-x) for x positive.
-      static const double A0 = 1.0;
-      static const double A1 = 0.125;
-      static const double A2 = 0.0078125;
-      static const double A3 = 0.00032552083;
-      static const double A4 = 1.0172526e-5;
+      constexpr double A0 = 1.0;
+      constexpr double A1 = 0.125;
+      constexpr double A2 = 0.0078125;
+      constexpr double A3 = 0.00032552083;
+      constexpr double A4 = 1.0172526e-5;
 
       if (x < 13.0)
       {




More information about the mlpack-git mailing list