Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
pmineiro committed Jul 17, 2011
1 parent 962ffde commit eb4ea4f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
4 changes: 3 additions & 1 deletion fastapprox/configure.ac.local
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
dnl -- include additional autoconf commands here
dnl -- do not include AC_OUTPUT, this is called for you

AC_CHECK_HEADERS([emmintrin.h boost/math/special_functions/digamma.hpp])
AC_CHECK_HEADERS([emmintrin.h boost/math/special_functions/digamma.hpp gsl/gsl_sf_lambert.h])

PKG_CHECK_MODULES([GSL], [gsl])
2 changes: 1 addition & 1 deletion fastapprox/tests/Makefile.am.local
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ testfastlambertwcpp_SOURCES = \
testfastlambertwcpp.cc

testfastlambertw_LDADD = \
-lm
-lm ${GSL_LIBS}

testfastlambertwcpp_LDADD = \
-lm
Expand Down
18 changes: 17 additions & 1 deletion fastapprox/tests/testfastlambertw.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@

#include "testmacros.h"

#include "../src/config.h"
#ifdef HAVE_GSL_GSL_SF_LAMBERT_H
#include <gsl/gsl_sf_lambert.h>
#endif

static inline float
lambertwrange (void)
{
Expand All @@ -28,7 +33,7 @@ lambertwf (float x)
float w = (x < 5) ? 0 : log (x) - log (log (x)) + log (log (x)) / log (x);
unsigned int n;

for (n = 0; n < 10; ++n)
for (n = 0; n < 20; ++n)
{
w = (w * w + exp (-w) * x) / (1.0 + w);
}
Expand All @@ -39,6 +44,10 @@ lambertwf (float x)
test_scalar (fastlambertw, lambertwf, lambertwrange (), 1e-4f, 100000000)
test_scalar (fasterlambertw, lambertwf, lambertwrange (), 1e-2f, 100000000)

#ifdef HAVE_GSL_GSL_SF_LAMBERT_H
test_scalar (gsl_sf_lambert_W0, lambertwf, lambertwrange (), 1e-2f, 1000000)
#endif

test_vector (vfastlambertw, lambertwf, lambertwrange (), 1e-4f, 100000000)
test_vector (vfasterlambertw, lambertwf, lambertwrange (), 1e-2f, 100000000)

Expand Down Expand Up @@ -69,11 +78,18 @@ main (int argc,
test_fasterlambertw ();
test_vfastlambertw ();
test_vfasterlambertw ();
#ifdef HAVE_GSL_GSL_SF_LAMBERT_H
test_gsl_sf_lambert_W0 ();
#endif

time_fastlambertw ();
time_fasterlambertw ();
time_vfastlambertw ();
time_vfasterlambertw ();

#ifdef HAVE_GSL_GSL_SF_LAMBERT_H
time_gsl_sf_lambert_W0 ();
#endif

return 0;
}

0 comments on commit eb4ea4f

Please sign in to comment.