MCPcopy Create free account
hub / github.com/davisking/dlib / test_cyl_bessel_i

Function test_cyl_bessel_i

dlib/test/math.cpp:13–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11
12 template<typename R>
13 void test_cyl_bessel_i()
14 {
15 constexpr R tol = std::is_same<R,float>::value ? 1e-3 : 1e-9;
16
17 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(0,0.0) - 1.0) < tol);
18 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(0,9.5367431640625e-7) - 1.00000000000022737367544324498417583090700894607432256476338) < tol);
19 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(0,0.0009765625) - 1.00000023841859331241759166109699567801556273303717896447683) < tol);
20 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(0,0.1) - 1.00250156293410) < tol);
21 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(0,0.2) - 1.01002502779515) < tol);
22 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(0,0.5) - 1.06348337074132) < tol);
23 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(0,1.0) - 1.26606587775200833559824462521471753760767031135496220680814) < tol);
24 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(0,2.0) - 2.27958530233606726743720444081153335328584110278545905407084) < tol);
25 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(0,3.0) - 4.88079258586503) < tol);
26 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(0,4.0) - 11.3019219521363304963562701832171024974126165944353377060065) < tol);
27 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(0,7.0) - 168.593908510289698857326627187500840376522679234531714193194) < tol);
28
29 // check case when nu=0.5
30 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(0.5,0.0) - 0.000000000000000) < tol);
31 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(0.5,0.1) - 0.252733984600132) < tol);
32 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(0.5,0.2) - 0.359208417583362) < tol);
33 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(0.5,0.5) - 0.587993086790417) < tol);
34 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(0.5,1.0) - 0.937674888245489) < tol);
35 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(0.5,2.0) - 2.046236863089057) < tol);
36 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(0.5,3.0) - 4.614822903407577) < tol);
37
38 // check case when nu=1
39 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(1,0.0) - 0.000000000000000) < tol);
40 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(1,9.5367431640625e-7) - 4.76837158203179210108624277276025646653133998635956784292029E-7) < tol);
41 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(1,0.0009765625) - 0.000488281308207663226432087816784315537514225208473395063575150) < tol);
42 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(1,1.0) - 0.565159103992485027207696027609863307328899621621092009480294) < tol);
43 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(1,2.0) - 1.59063685463732906338225442499966624795447815949553664713229) < tol);
44 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(1,4.0) - 9.75946515370444990947519256731268090005597033325296730692753) < tol);
45
46 // check case when nu=1.3
47 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(1.3,0.0) - 0.000000000000000) < tol);
48 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(1.3,0.1) - 0.017465030873157) < tol);
49 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(1.3,0.2) - 0.043144293848607) < tol);
50 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(1.3,0.5) - 0.145248507279042) < tol);
51 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(1.3,1.0) - 0.387392350983796) < tol);
52 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(1.3,2.0) - 1.290819215135879) < tol);
53 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(1.3,3.0) - 3.450680420553085) < tol);
54
55 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(2.0,0.0) - 0.000000000000000) < tol);
56 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(2.0,9.5367431640625e-7) - 1.13686837721624646204093977095674566928522671779753217215467e-13) < tol);
57 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(5.0,1.0) - 0.000271463155956971875181073905153777342383564426758143634974124) < tol);
58 DLIB_TEST(std::abs(dlib::cyl_bessel_i<R,R>(5.0,10.0) - 777.188286403259959907293484802339632852674154572666041953297) < tol);
59 }
60
61 template<typename R>
62 void test_cyl_bessel_j()

Callers

nothing calls this directly

Calls 1

absFunction · 0.85

Tested by

no test coverage detected