gauss.hpp 53 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300
  1. // Copyright John Maddock 2015.
  2. // Use, modification and distribution are subject to the
  3. // Boost Software License, Version 1.0. (See accompanying file
  4. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. #ifndef BOOST_MATH_QUADRATURE_GAUSS_HPP
  6. #define BOOST_MATH_QUADRATURE_GAUSS_HPP
  7. #ifdef _MSC_VER
  8. #pragma once
  9. #endif
  10. #include <limits>
  11. #include <vector>
  12. #include <boost/math/special_functions/legendre.hpp>
  13. #include <boost/math/constants/constants.hpp>
  14. #ifdef _MSC_VER
  15. #pragma warning(push)
  16. #pragma warning(disable:4127)
  17. #endif
  18. namespace boost { namespace math{ namespace quadrature{ namespace detail{
  19. template <class T>
  20. struct gauss_constant_category
  21. {
  22. static const unsigned value =
  23. (std::numeric_limits<T>::is_specialized == 0) ? 999 :
  24. (std::numeric_limits<T>::radix == 2) ?
  25. (
  26. (std::numeric_limits<T>::digits <= std::numeric_limits<float>::digits) && std::is_convertible<float, T>::value ? 0 :
  27. (std::numeric_limits<T>::digits <= std::numeric_limits<double>::digits) && std::is_convertible<double, T>::value ? 1 :
  28. (std::numeric_limits<T>::digits <= std::numeric_limits<long double>::digits) && std::is_convertible<long double, T>::value ? 2 :
  29. #ifdef BOOST_HAS_FLOAT128
  30. (std::numeric_limits<T>::digits <= 113) && std::is_constructible<__float128, T>::value ? 3 :
  31. #endif
  32. (std::numeric_limits<T>::digits10 <= 110) ? 4 : 999
  33. ) : (std::numeric_limits<T>::digits10 <= 110) ? 4 : 999;
  34. };
  35. #ifndef BOOST_MATH_GAUSS_NO_COMPUTE_ON_DEMAND
  36. template <class Real, unsigned N, unsigned Category>
  37. class gauss_detail
  38. {
  39. static std::vector<Real> calculate_weights()
  40. {
  41. std::vector<Real> result(abscissa().size(), 0);
  42. for (unsigned i = 0; i < abscissa().size(); ++i)
  43. {
  44. Real x = abscissa()[i];
  45. Real p = boost::math::legendre_p_prime(N, x);
  46. result[i] = 2 / ((1 - x * x) * p * p);
  47. }
  48. return result;
  49. }
  50. public:
  51. static const std::vector<Real>& abscissa()
  52. {
  53. static std::vector<Real> data = boost::math::legendre_p_zeros<Real>(N);
  54. return data;
  55. }
  56. static const std::vector<Real>& weights()
  57. {
  58. static std::vector<Real> data = calculate_weights();
  59. return data;
  60. }
  61. };
  62. #else
  63. template <class Real, unsigned N, unsigned Category>
  64. class gauss_detail;
  65. #endif
  66. template <class T>
  67. class gauss_detail<T, 7, 0>
  68. {
  69. public:
  70. static std::array<T, 4> const & abscissa()
  71. {
  72. static constexpr std::array<T, 4> data = {
  73. 0.000000000e+00f,
  74. 4.058451514e-01f,
  75. 7.415311856e-01f,
  76. 9.491079123e-01f,
  77. };
  78. return data;
  79. }
  80. static std::array<T, 4> const & weights()
  81. {
  82. static constexpr std::array<T, 4> data = {
  83. 4.179591837e-01f,
  84. 3.818300505e-01f,
  85. 2.797053915e-01f,
  86. 1.294849662e-01f,
  87. };
  88. return data;
  89. }
  90. };
  91. template <class T>
  92. class gauss_detail<T, 7, 1>
  93. {
  94. public:
  95. static std::array<T, 4> const & abscissa()
  96. {
  97. static constexpr std::array<T, 4> data = {
  98. 0.00000000000000000e+00,
  99. 4.05845151377397167e-01,
  100. 7.41531185599394440e-01,
  101. 9.49107912342758525e-01,
  102. };
  103. return data;
  104. }
  105. static std::array<T, 4> const & weights()
  106. {
  107. static constexpr std::array<T, 4> data = {
  108. 4.17959183673469388e-01,
  109. 3.81830050505118945e-01,
  110. 2.79705391489276668e-01,
  111. 1.29484966168869693e-01,
  112. };
  113. return data;
  114. }
  115. };
  116. template <class T>
  117. class gauss_detail<T, 7, 2>
  118. {
  119. public:
  120. static std::array<T, 4> const & abscissa()
  121. {
  122. static constexpr std::array<T, 4> data = {
  123. 0.00000000000000000000000000000000000e+00L,
  124. 4.05845151377397166906606412076961463e-01L,
  125. 7.41531185599394439863864773280788407e-01L,
  126. 9.49107912342758524526189684047851262e-01L,
  127. };
  128. return data;
  129. }
  130. static std::array<T, 4> const & weights()
  131. {
  132. static constexpr std::array<T, 4> data = {
  133. 4.17959183673469387755102040816326531e-01L,
  134. 3.81830050505118944950369775488975134e-01L,
  135. 2.79705391489276667901467771423779582e-01L,
  136. 1.29484966168869693270611432679082018e-01L,
  137. };
  138. return data;
  139. }
  140. };
  141. #ifdef BOOST_HAS_FLOAT128
  142. template <class T>
  143. class gauss_detail<T, 7, 3>
  144. {
  145. public:
  146. static std::array<T, 4> const & abscissa()
  147. {
  148. static const std::array<T, 4> data = {
  149. 0.00000000000000000000000000000000000e+00Q,
  150. 4.05845151377397166906606412076961463e-01Q,
  151. 7.41531185599394439863864773280788407e-01Q,
  152. 9.49107912342758524526189684047851262e-01Q,
  153. };
  154. return data;
  155. }
  156. static std::array<T, 4> const & weights()
  157. {
  158. static const std::array<T, 4> data = {
  159. 4.17959183673469387755102040816326531e-01Q,
  160. 3.81830050505118944950369775488975134e-01Q,
  161. 2.79705391489276667901467771423779582e-01Q,
  162. 1.29484966168869693270611432679082018e-01Q,
  163. };
  164. return data;
  165. }
  166. };
  167. #endif
  168. template <class T>
  169. class gauss_detail<T, 7, 4>
  170. {
  171. public:
  172. static std::array<T, 4> const & abscissa()
  173. {
  174. static std::array<T, 4> data = {
  175. BOOST_MATH_HUGE_CONSTANT(T, 0, 0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e+00),
  176. BOOST_MATH_HUGE_CONSTANT(T, 0, 4.0584515137739716690660641207696146334738201409937012638704325179466381322612565532831268972774658776528675866604802e-01),
  177. BOOST_MATH_HUGE_CONSTANT(T, 0, 7.4153118559939443986386477328078840707414764714139026011995535196742987467218051379282683236686324705969251809311201e-01),
  178. BOOST_MATH_HUGE_CONSTANT(T, 0, 9.4910791234275852452618968404785126240077093767061778354876910391306333035484014080573077002792572414430073966699522e-01),
  179. };
  180. return data;
  181. }
  182. static std::array<T, 4> const & weights()
  183. {
  184. static std::array<T, 4> data = {
  185. BOOST_MATH_HUGE_CONSTANT(T, 0, 4.1795918367346938775510204081632653061224489795918367346938775510204081632653061224489795918367346938775510204081633e-01),
  186. BOOST_MATH_HUGE_CONSTANT(T, 0, 3.8183005050511894495036977548897513387836508353386273475108345103070554643412970834868465934404480145031467176458536e-01),
  187. BOOST_MATH_HUGE_CONSTANT(T, 0, 2.7970539148927666790146777142377958248692506522659876453701403269361881043056267681324094290119761876632337521337205e-01),
  188. BOOST_MATH_HUGE_CONSTANT(T, 0, 1.2948496616886969327061143267908201832858740225994666397720863872465523497204230871562541816292084508948440200163443e-01),
  189. };
  190. return data;
  191. }
  192. };
  193. template <class T>
  194. class gauss_detail<T, 10, 0>
  195. {
  196. public:
  197. static std::array<T, 5> const & abscissa()
  198. {
  199. static constexpr std::array<T, 5> data = {
  200. 1.488743390e-01f,
  201. 4.333953941e-01f,
  202. 6.794095683e-01f,
  203. 8.650633667e-01f,
  204. 9.739065285e-01f,
  205. };
  206. return data;
  207. }
  208. static std::array<T, 5> const & weights()
  209. {
  210. static constexpr std::array<T, 5> data = {
  211. 2.955242247e-01f,
  212. 2.692667193e-01f,
  213. 2.190863625e-01f,
  214. 1.494513492e-01f,
  215. 6.667134431e-02f,
  216. };
  217. return data;
  218. }
  219. };
  220. template <class T>
  221. class gauss_detail<T, 10, 1>
  222. {
  223. public:
  224. static std::array<T, 5> const & abscissa()
  225. {
  226. static constexpr std::array<T, 5> data = {
  227. 1.48874338981631211e-01,
  228. 4.33395394129247191e-01,
  229. 6.79409568299024406e-01,
  230. 8.65063366688984511e-01,
  231. 9.73906528517171720e-01,
  232. };
  233. return data;
  234. }
  235. static std::array<T, 5> const & weights()
  236. {
  237. static constexpr std::array<T, 5> data = {
  238. 2.95524224714752870e-01,
  239. 2.69266719309996355e-01,
  240. 2.19086362515982044e-01,
  241. 1.49451349150580593e-01,
  242. 6.66713443086881376e-02,
  243. };
  244. return data;
  245. }
  246. };
  247. template <class T>
  248. class gauss_detail<T, 10, 2>
  249. {
  250. public:
  251. static std::array<T, 5> const & abscissa()
  252. {
  253. static constexpr std::array<T, 5> data = {
  254. 1.48874338981631210884826001129719985e-01L,
  255. 4.33395394129247190799265943165784162e-01L,
  256. 6.79409568299024406234327365114873576e-01L,
  257. 8.65063366688984510732096688423493049e-01L,
  258. 9.73906528517171720077964012084452053e-01L,
  259. };
  260. return data;
  261. }
  262. static std::array<T, 5> const & weights()
  263. {
  264. static constexpr std::array<T, 5> data = {
  265. 2.95524224714752870173892994651338329e-01L,
  266. 2.69266719309996355091226921569469353e-01L,
  267. 2.19086362515982043995534934228163192e-01L,
  268. 1.49451349150580593145776339657697332e-01L,
  269. 6.66713443086881375935688098933317929e-02L,
  270. };
  271. return data;
  272. }
  273. };
  274. #ifdef BOOST_HAS_FLOAT128
  275. template <class T>
  276. class gauss_detail<T, 10, 3>
  277. {
  278. public:
  279. static std::array<T, 5> const & abscissa()
  280. {
  281. static const std::array<T, 5> data = {
  282. 1.48874338981631210884826001129719985e-01Q,
  283. 4.33395394129247190799265943165784162e-01Q,
  284. 6.79409568299024406234327365114873576e-01Q,
  285. 8.65063366688984510732096688423493049e-01Q,
  286. 9.73906528517171720077964012084452053e-01Q,
  287. };
  288. return data;
  289. }
  290. static std::array<T, 5> const & weights()
  291. {
  292. static const std::array<T, 5> data = {
  293. 2.95524224714752870173892994651338329e-01Q,
  294. 2.69266719309996355091226921569469353e-01Q,
  295. 2.19086362515982043995534934228163192e-01Q,
  296. 1.49451349150580593145776339657697332e-01Q,
  297. 6.66713443086881375935688098933317929e-02Q,
  298. };
  299. return data;
  300. }
  301. };
  302. #endif
  303. template <class T>
  304. class gauss_detail<T, 10, 4>
  305. {
  306. public:
  307. static std::array<T, 5> const & abscissa()
  308. {
  309. static std::array<T, 5> data = {
  310. BOOST_MATH_HUGE_CONSTANT(T, 0, 1.4887433898163121088482600112971998461756485942069169570798925351590361735566852137117762979946369123003116080525534e-01),
  311. BOOST_MATH_HUGE_CONSTANT(T, 0, 4.3339539412924719079926594316578416220007183765624649650270151314376698907770350122510275795011772122368293504099894e-01),
  312. BOOST_MATH_HUGE_CONSTANT(T, 0, 6.7940956829902440623432736511487357576929471183480946766481718895255857539507492461507857357048037949983390204739932e-01),
  313. BOOST_MATH_HUGE_CONSTANT(T, 0, 8.6506336668898451073209668842349304852754301496533045252195973184537475513805556135679072894604577069440463108641177e-01),
  314. BOOST_MATH_HUGE_CONSTANT(T, 0, 9.7390652851717172007796401208445205342826994669238211923121206669659520323463615962572356495626855625823304251877421e-01),
  315. };
  316. return data;
  317. }
  318. static std::array<T, 5> const & weights()
  319. {
  320. static std::array<T, 5> data = {
  321. BOOST_MATH_HUGE_CONSTANT(T, 0, 2.9552422471475287017389299465133832942104671702685360135430802975599593821715232927035659579375421672271716440125256e-01),
  322. BOOST_MATH_HUGE_CONSTANT(T, 0, 2.6926671930999635509122692156946935285975993846088379580056327624215343231917927676422663670925276075559581145036870e-01),
  323. BOOST_MATH_HUGE_CONSTANT(T, 0, 2.1908636251598204399553493422816319245877187052267708988095654363519991065295128124268399317720219278659121687281289e-01),
  324. BOOST_MATH_HUGE_CONSTANT(T, 0, 1.4945134915058059314577633965769733240255663966942736783547726875323865472663001094594726463473195191400575256104544e-01),
  325. BOOST_MATH_HUGE_CONSTANT(T, 0, 6.6671344308688137593568809893331792857864834320158145128694881613412064084087101776785509685058877821090054714520419e-02),
  326. };
  327. return data;
  328. }
  329. };
  330. template <class T>
  331. class gauss_detail<T, 15, 0>
  332. {
  333. public:
  334. static std::array<T, 8> const & abscissa()
  335. {
  336. static constexpr std::array<T, 8> data = {
  337. 0.000000000e+00f,
  338. 2.011940940e-01f,
  339. 3.941513471e-01f,
  340. 5.709721726e-01f,
  341. 7.244177314e-01f,
  342. 8.482065834e-01f,
  343. 9.372733924e-01f,
  344. 9.879925180e-01f,
  345. };
  346. return data;
  347. }
  348. static std::array<T, 8> const & weights()
  349. {
  350. static constexpr std::array<T, 8> data = {
  351. 2.025782419e-01f,
  352. 1.984314853e-01f,
  353. 1.861610000e-01f,
  354. 1.662692058e-01f,
  355. 1.395706779e-01f,
  356. 1.071592205e-01f,
  357. 7.036604749e-02f,
  358. 3.075324200e-02f,
  359. };
  360. return data;
  361. }
  362. };
  363. template <class T>
  364. class gauss_detail<T, 15, 1>
  365. {
  366. public:
  367. static std::array<T, 8> const & abscissa()
  368. {
  369. static constexpr std::array<T, 8> data = {
  370. 0.00000000000000000e+00,
  371. 2.01194093997434522e-01,
  372. 3.94151347077563370e-01,
  373. 5.70972172608538848e-01,
  374. 7.24417731360170047e-01,
  375. 8.48206583410427216e-01,
  376. 9.37273392400705904e-01,
  377. 9.87992518020485428e-01,
  378. };
  379. return data;
  380. }
  381. static std::array<T, 8> const & weights()
  382. {
  383. static constexpr std::array<T, 8> data = {
  384. 2.02578241925561273e-01,
  385. 1.98431485327111576e-01,
  386. 1.86161000015562211e-01,
  387. 1.66269205816993934e-01,
  388. 1.39570677926154314e-01,
  389. 1.07159220467171935e-01,
  390. 7.03660474881081247e-02,
  391. 3.07532419961172684e-02,
  392. };
  393. return data;
  394. }
  395. };
  396. template <class T>
  397. class gauss_detail<T, 15, 2>
  398. {
  399. public:
  400. static std::array<T, 8> const & abscissa()
  401. {
  402. static constexpr std::array<T, 8> data = {
  403. 0.00000000000000000000000000000000000e+00L,
  404. 2.01194093997434522300628303394596208e-01L,
  405. 3.94151347077563369897207370981045468e-01L,
  406. 5.70972172608538847537226737253910641e-01L,
  407. 7.24417731360170047416186054613938010e-01L,
  408. 8.48206583410427216200648320774216851e-01L,
  409. 9.37273392400705904307758947710209471e-01L,
  410. 9.87992518020485428489565718586612581e-01L,
  411. };
  412. return data;
  413. }
  414. static std::array<T, 8> const & weights()
  415. {
  416. static constexpr std::array<T, 8> data = {
  417. 2.02578241925561272880620199967519315e-01L,
  418. 1.98431485327111576456118326443839325e-01L,
  419. 1.86161000015562211026800561866422825e-01L,
  420. 1.66269205816993933553200860481208811e-01L,
  421. 1.39570677926154314447804794511028323e-01L,
  422. 1.07159220467171935011869546685869303e-01L,
  423. 7.03660474881081247092674164506673385e-02L,
  424. 3.07532419961172683546283935772044177e-02L,
  425. };
  426. return data;
  427. }
  428. };
  429. #ifdef BOOST_HAS_FLOAT128
  430. template <class T>
  431. class gauss_detail<T, 15, 3>
  432. {
  433. public:
  434. static std::array<T, 8> const & abscissa()
  435. {
  436. static const std::array<T, 8> data = {
  437. 0.00000000000000000000000000000000000e+00Q,
  438. 2.01194093997434522300628303394596208e-01Q,
  439. 3.94151347077563369897207370981045468e-01Q,
  440. 5.70972172608538847537226737253910641e-01Q,
  441. 7.24417731360170047416186054613938010e-01Q,
  442. 8.48206583410427216200648320774216851e-01Q,
  443. 9.37273392400705904307758947710209471e-01Q,
  444. 9.87992518020485428489565718586612581e-01Q,
  445. };
  446. return data;
  447. }
  448. static std::array<T, 8> const & weights()
  449. {
  450. static const std::array<T, 8> data = {
  451. 2.02578241925561272880620199967519315e-01Q,
  452. 1.98431485327111576456118326443839325e-01Q,
  453. 1.86161000015562211026800561866422825e-01Q,
  454. 1.66269205816993933553200860481208811e-01Q,
  455. 1.39570677926154314447804794511028323e-01Q,
  456. 1.07159220467171935011869546685869303e-01Q,
  457. 7.03660474881081247092674164506673385e-02Q,
  458. 3.07532419961172683546283935772044177e-02Q,
  459. };
  460. return data;
  461. }
  462. };
  463. #endif
  464. template <class T>
  465. class gauss_detail<T, 15, 4>
  466. {
  467. public:
  468. static std::array<T, 8> const & abscissa()
  469. {
  470. static std::array<T, 8> data = {
  471. BOOST_MATH_HUGE_CONSTANT(T, 0, 0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e+00),
  472. BOOST_MATH_HUGE_CONSTANT(T, 0, 2.0119409399743452230062830339459620781283645446263767961594972460994823900302018760183625806752105908967902257386509e-01),
  473. BOOST_MATH_HUGE_CONSTANT(T, 0, 3.9415134707756336989720737098104546836275277615869825503116534395160895778696141797549711416165976202589352169635648e-01),
  474. BOOST_MATH_HUGE_CONSTANT(T, 0, 5.7097217260853884753722673725391064123838639628274960485326541705419537986975857948341462856982614477912646497026257e-01),
  475. BOOST_MATH_HUGE_CONSTANT(T, 0, 7.2441773136017004741618605461393800963089929458410256355142342070412378167792521899610109760313432626923598549381925e-01),
  476. BOOST_MATH_HUGE_CONSTANT(T, 0, 8.4820658341042721620064832077421685136625617473699263409572755876067507517414548519760771975082148085090373835713340e-01),
  477. BOOST_MATH_HUGE_CONSTANT(T, 0, 9.3727339240070590430775894771020947124399627351530445790136307635020297379704552795054758617426808659746824044603157e-01),
  478. BOOST_MATH_HUGE_CONSTANT(T, 0, 9.8799251802048542848956571858661258114697281712376148999999751558738843736901942471272205036831914497667516843990079e-01),
  479. };
  480. return data;
  481. }
  482. static std::array<T, 8> const & weights()
  483. {
  484. static std::array<T, 8> data = {
  485. BOOST_MATH_HUGE_CONSTANT(T, 0, 2.0257824192556127288062019996751931483866215800947735679670411605143539875474607409339344071278803213535148267082999e-01),
  486. BOOST_MATH_HUGE_CONSTANT(T, 0, 1.9843148532711157645611832644383932481869255995754199348473792792912479753343426813331499916481782320766020854889310e-01),
  487. BOOST_MATH_HUGE_CONSTANT(T, 0, 1.8616100001556221102680056186642282450622601227792840281549572731001325550269916061894976888609932360539977709001384e-01),
  488. BOOST_MATH_HUGE_CONSTANT(T, 0, 1.6626920581699393355320086048120881113090018009841290732186519056355356321227851771070517429241553621484461540657185e-01),
  489. BOOST_MATH_HUGE_CONSTANT(T, 0, 1.3957067792615431444780479451102832252085027531551124320239112863108844454190781168076825736357133363814908889327664e-01),
  490. BOOST_MATH_HUGE_CONSTANT(T, 0, 1.0715922046717193501186954668586930341554371575810198068702238912187799485231579972568585713760862404439808767837506e-01),
  491. BOOST_MATH_HUGE_CONSTANT(T, 0, 7.0366047488108124709267416450667338466708032754330719825907292914387055512874237044840452066693939219355489858595041e-02),
  492. BOOST_MATH_HUGE_CONSTANT(T, 0, 3.0753241996117268354628393577204417721748144833434074264228285504237189467117168039038770732399404002516991188859473e-02),
  493. };
  494. return data;
  495. }
  496. };
  497. template <class T>
  498. class gauss_detail<T, 20, 0>
  499. {
  500. public:
  501. static std::array<T, 10> const & abscissa()
  502. {
  503. static constexpr std::array<T, 10> data = {
  504. 7.652652113e-02f,
  505. 2.277858511e-01f,
  506. 3.737060887e-01f,
  507. 5.108670020e-01f,
  508. 6.360536807e-01f,
  509. 7.463319065e-01f,
  510. 8.391169718e-01f,
  511. 9.122344283e-01f,
  512. 9.639719273e-01f,
  513. 9.931285992e-01f,
  514. };
  515. return data;
  516. }
  517. static std::array<T, 10> const & weights()
  518. {
  519. static constexpr std::array<T, 10> data = {
  520. 1.527533871e-01f,
  521. 1.491729865e-01f,
  522. 1.420961093e-01f,
  523. 1.316886384e-01f,
  524. 1.181945320e-01f,
  525. 1.019301198e-01f,
  526. 8.327674158e-02f,
  527. 6.267204833e-02f,
  528. 4.060142980e-02f,
  529. 1.761400714e-02f,
  530. };
  531. return data;
  532. }
  533. };
  534. template <class T>
  535. class gauss_detail<T, 20, 1>
  536. {
  537. public:
  538. static std::array<T, 10> const & abscissa()
  539. {
  540. static constexpr std::array<T, 10> data = {
  541. 7.65265211334973338e-02,
  542. 2.27785851141645078e-01,
  543. 3.73706088715419561e-01,
  544. 5.10867001950827098e-01,
  545. 6.36053680726515025e-01,
  546. 7.46331906460150793e-01,
  547. 8.39116971822218823e-01,
  548. 9.12234428251325906e-01,
  549. 9.63971927277913791e-01,
  550. 9.93128599185094925e-01,
  551. };
  552. return data;
  553. }
  554. static std::array<T, 10> const & weights()
  555. {
  556. static constexpr std::array<T, 10> data = {
  557. 1.52753387130725851e-01,
  558. 1.49172986472603747e-01,
  559. 1.42096109318382051e-01,
  560. 1.31688638449176627e-01,
  561. 1.18194531961518417e-01,
  562. 1.01930119817240435e-01,
  563. 8.32767415767047487e-02,
  564. 6.26720483341090636e-02,
  565. 4.06014298003869413e-02,
  566. 1.76140071391521183e-02,
  567. };
  568. return data;
  569. }
  570. };
  571. template <class T>
  572. class gauss_detail<T, 20, 2>
  573. {
  574. public:
  575. static std::array<T, 10> const & abscissa()
  576. {
  577. static constexpr std::array<T, 10> data = {
  578. 7.65265211334973337546404093988382110e-02L,
  579. 2.27785851141645078080496195368574625e-01L,
  580. 3.73706088715419560672548177024927237e-01L,
  581. 5.10867001950827098004364050955250998e-01L,
  582. 6.36053680726515025452836696226285937e-01L,
  583. 7.46331906460150792614305070355641590e-01L,
  584. 8.39116971822218823394529061701520685e-01L,
  585. 9.12234428251325905867752441203298113e-01L,
  586. 9.63971927277913791267666131197277222e-01L,
  587. 9.93128599185094924786122388471320278e-01L,
  588. };
  589. return data;
  590. }
  591. static std::array<T, 10> const & weights()
  592. {
  593. static constexpr std::array<T, 10> data = {
  594. 1.52753387130725850698084331955097593e-01L,
  595. 1.49172986472603746787828737001969437e-01L,
  596. 1.42096109318382051329298325067164933e-01L,
  597. 1.31688638449176626898494499748163135e-01L,
  598. 1.18194531961518417312377377711382287e-01L,
  599. 1.01930119817240435036750135480349876e-01L,
  600. 8.32767415767047487247581432220462061e-02L,
  601. 6.26720483341090635695065351870416064e-02L,
  602. 4.06014298003869413310399522749321099e-02L,
  603. 1.76140071391521183118619623518528164e-02L,
  604. };
  605. return data;
  606. }
  607. };
  608. #ifdef BOOST_HAS_FLOAT128
  609. template <class T>
  610. class gauss_detail<T, 20, 3>
  611. {
  612. public:
  613. static std::array<T, 10> const & abscissa()
  614. {
  615. static const std::array<T, 10> data = {
  616. 7.65265211334973337546404093988382110e-02Q,
  617. 2.27785851141645078080496195368574625e-01Q,
  618. 3.73706088715419560672548177024927237e-01Q,
  619. 5.10867001950827098004364050955250998e-01Q,
  620. 6.36053680726515025452836696226285937e-01Q,
  621. 7.46331906460150792614305070355641590e-01Q,
  622. 8.39116971822218823394529061701520685e-01Q,
  623. 9.12234428251325905867752441203298113e-01Q,
  624. 9.63971927277913791267666131197277222e-01Q,
  625. 9.93128599185094924786122388471320278e-01Q,
  626. };
  627. return data;
  628. }
  629. static std::array<T, 10> const & weights()
  630. {
  631. static const std::array<T, 10> data = {
  632. 1.52753387130725850698084331955097593e-01Q,
  633. 1.49172986472603746787828737001969437e-01Q,
  634. 1.42096109318382051329298325067164933e-01Q,
  635. 1.31688638449176626898494499748163135e-01Q,
  636. 1.18194531961518417312377377711382287e-01Q,
  637. 1.01930119817240435036750135480349876e-01Q,
  638. 8.32767415767047487247581432220462061e-02Q,
  639. 6.26720483341090635695065351870416064e-02Q,
  640. 4.06014298003869413310399522749321099e-02Q,
  641. 1.76140071391521183118619623518528164e-02Q,
  642. };
  643. return data;
  644. }
  645. };
  646. #endif
  647. template <class T>
  648. class gauss_detail<T, 20, 4>
  649. {
  650. public:
  651. static std::array<T, 10> const & abscissa()
  652. {
  653. static std::array<T, 10> data = {
  654. BOOST_MATH_HUGE_CONSTANT(T, 0, 7.6526521133497333754640409398838211004796266813497500804795244384256342048336978241545114181556215606998505646364133e-02),
  655. BOOST_MATH_HUGE_CONSTANT(T, 0, 2.2778585114164507808049619536857462474308893768292747231463573920717134186355582779495212519096870803177373131560430e-01),
  656. BOOST_MATH_HUGE_CONSTANT(T, 0, 3.7370608871541956067254817702492723739574632170568271182794861351564576437305952789589568363453337894476772208852815e-01),
  657. BOOST_MATH_HUGE_CONSTANT(T, 0, 5.1086700195082709800436405095525099842549132920242683347234861989473497039076572814403168305086777919832943068843526e-01),
  658. BOOST_MATH_HUGE_CONSTANT(T, 0, 6.3605368072651502545283669622628593674338911679936846393944662254654126258543013255870319549576130658211710937772596e-01),
  659. BOOST_MATH_HUGE_CONSTANT(T, 0, 7.4633190646015079261430507035564159031073067956917644413954590606853535503815506468110411362064752061238490065167656e-01),
  660. BOOST_MATH_HUGE_CONSTANT(T, 0, 8.3911697182221882339452906170152068532962936506563737325249272553286109399932480991922934056595764922060422035306914e-01),
  661. BOOST_MATH_HUGE_CONSTANT(T, 0, 9.1223442825132590586775244120329811304918479742369177479588221915807089120871907893644472619292138737876039175464603e-01),
  662. BOOST_MATH_HUGE_CONSTANT(T, 0, 9.6397192727791379126766613119727722191206032780618885606353759389204158078438305698001812525596471563131043491596423e-01),
  663. BOOST_MATH_HUGE_CONSTANT(T, 0, 9.9312859918509492478612238847132027822264713090165589614818413121798471762775378083944940249657220927472894034724419e-01),
  664. };
  665. return data;
  666. }
  667. static std::array<T, 10> const & weights()
  668. {
  669. static std::array<T, 10> data = {
  670. BOOST_MATH_HUGE_CONSTANT(T, 0, 1.5275338713072585069808433195509759349194864511237859727470104981759745316273778153557248783650390593544001842813788e-01),
  671. BOOST_MATH_HUGE_CONSTANT(T, 0, 1.4917298647260374678782873700196943669267990408136831649621121780984442259558678069396132603521048105170913854567338e-01),
  672. BOOST_MATH_HUGE_CONSTANT(T, 0, 1.4209610931838205132929832506716493303451541339202030333736708298382808749793436761694922428320058260133068573666201e-01),
  673. BOOST_MATH_HUGE_CONSTANT(T, 0, 1.3168863844917662689849449974816313491611051114698352699643649370885435642948093314355797518397262924510598005463625e-01),
  674. BOOST_MATH_HUGE_CONSTANT(T, 0, 1.1819453196151841731237737771138228700504121954896877544688995202017474835051151630572868782581901744606267543092317e-01),
  675. BOOST_MATH_HUGE_CONSTANT(T, 0, 1.0193011981724043503675013548034987616669165602339255626197161619685232202539434647534931576947985821375859035525483e-01),
  676. BOOST_MATH_HUGE_CONSTANT(T, 0, 8.3276741576704748724758143222046206100177828583163290744882060785693082894079419471375190843790839349096116111932764e-02),
  677. BOOST_MATH_HUGE_CONSTANT(T, 0, 6.2672048334109063569506535187041606351601076578436364099584345437974811033665678644563766056832203512603253399592073e-02),
  678. BOOST_MATH_HUGE_CONSTANT(T, 0, 4.0601429800386941331039952274932109879090639989951536817606854561832296750987328295538920623044384976189825709675075e-02),
  679. BOOST_MATH_HUGE_CONSTANT(T, 0, 1.7614007139152118311861962351852816362143105543336732524349326677348419259621847817403105542146097668703716227512570e-02),
  680. };
  681. return data;
  682. }
  683. };
  684. template <class T>
  685. class gauss_detail<T, 25, 0>
  686. {
  687. public:
  688. static std::array<T, 13> const & abscissa()
  689. {
  690. static constexpr std::array<T, 13> data = {
  691. 0.000000000e+00f,
  692. 1.228646926e-01f,
  693. 2.438668837e-01f,
  694. 3.611723058e-01f,
  695. 4.730027314e-01f,
  696. 5.776629302e-01f,
  697. 6.735663685e-01f,
  698. 7.592592630e-01f,
  699. 8.334426288e-01f,
  700. 8.949919979e-01f,
  701. 9.429745712e-01f,
  702. 9.766639215e-01f,
  703. 9.955569698e-01f,
  704. };
  705. return data;
  706. }
  707. static std::array<T, 13> const & weights()
  708. {
  709. static constexpr std::array<T, 13> data = {
  710. 1.231760537e-01f,
  711. 1.222424430e-01f,
  712. 1.194557635e-01f,
  713. 1.148582591e-01f,
  714. 1.085196245e-01f,
  715. 1.005359491e-01f,
  716. 9.102826198e-02f,
  717. 8.014070034e-02f,
  718. 6.803833381e-02f,
  719. 5.490469598e-02f,
  720. 4.093915670e-02f,
  721. 2.635498662e-02f,
  722. 1.139379850e-02f,
  723. };
  724. return data;
  725. }
  726. };
  727. template <class T>
  728. class gauss_detail<T, 25, 1>
  729. {
  730. public:
  731. static std::array<T, 13> const & abscissa()
  732. {
  733. static constexpr std::array<T, 13> data = {
  734. 0.00000000000000000e+00,
  735. 1.22864692610710396e-01,
  736. 2.43866883720988432e-01,
  737. 3.61172305809387838e-01,
  738. 4.73002731445714961e-01,
  739. 5.77662930241222968e-01,
  740. 6.73566368473468364e-01,
  741. 7.59259263037357631e-01,
  742. 8.33442628760834001e-01,
  743. 8.94991997878275369e-01,
  744. 9.42974571228974339e-01,
  745. 9.76663921459517511e-01,
  746. 9.95556969790498098e-01,
  747. };
  748. return data;
  749. }
  750. static std::array<T, 13> const & weights()
  751. {
  752. static constexpr std::array<T, 13> data = {
  753. 1.23176053726715451e-01,
  754. 1.22242442990310042e-01,
  755. 1.19455763535784772e-01,
  756. 1.14858259145711648e-01,
  757. 1.08519624474263653e-01,
  758. 1.00535949067050644e-01,
  759. 9.10282619829636498e-02,
  760. 8.01407003350010180e-02,
  761. 6.80383338123569172e-02,
  762. 5.49046959758351919e-02,
  763. 4.09391567013063127e-02,
  764. 2.63549866150321373e-02,
  765. 1.13937985010262879e-02,
  766. };
  767. return data;
  768. }
  769. };
  770. template <class T>
  771. class gauss_detail<T, 25, 2>
  772. {
  773. public:
  774. static std::array<T, 13> const & abscissa()
  775. {
  776. static constexpr std::array<T, 13> data = {
  777. 0.00000000000000000000000000000000000e+00L,
  778. 1.22864692610710396387359818808036806e-01L,
  779. 2.43866883720988432045190362797451586e-01L,
  780. 3.61172305809387837735821730127640667e-01L,
  781. 4.73002731445714960522182115009192041e-01L,
  782. 5.77662930241222967723689841612654067e-01L,
  783. 6.73566368473468364485120633247622176e-01L,
  784. 7.59259263037357630577282865204360976e-01L,
  785. 8.33442628760834001421021108693569569e-01L,
  786. 8.94991997878275368851042006782804954e-01L,
  787. 9.42974571228974339414011169658470532e-01L,
  788. 9.76663921459517511498315386479594068e-01L,
  789. 9.95556969790498097908784946893901617e-01L,
  790. };
  791. return data;
  792. }
  793. static std::array<T, 13> const & weights()
  794. {
  795. static constexpr std::array<T, 13> data = {
  796. 1.23176053726715451203902873079050142e-01L,
  797. 1.22242442990310041688959518945851506e-01L,
  798. 1.19455763535784772228178126512901047e-01L,
  799. 1.14858259145711648339325545869555809e-01L,
  800. 1.08519624474263653116093957050116619e-01L,
  801. 1.00535949067050644202206890392685827e-01L,
  802. 9.10282619829636498114972207028916534e-02L,
  803. 8.01407003350010180132349596691113023e-02L,
  804. 6.80383338123569172071871856567079686e-02L,
  805. 5.49046959758351919259368915404733242e-02L,
  806. 4.09391567013063126556234877116459537e-02L,
  807. 2.63549866150321372619018152952991449e-02L,
  808. 1.13937985010262879479029641132347736e-02L,
  809. };
  810. return data;
  811. }
  812. };
  813. #ifdef BOOST_HAS_FLOAT128
  814. template <class T>
  815. class gauss_detail<T, 25, 3>
  816. {
  817. public:
  818. static std::array<T, 13> const & abscissa()
  819. {
  820. static const std::array<T, 13> data = {
  821. 0.00000000000000000000000000000000000e+00Q,
  822. 1.22864692610710396387359818808036806e-01Q,
  823. 2.43866883720988432045190362797451586e-01Q,
  824. 3.61172305809387837735821730127640667e-01Q,
  825. 4.73002731445714960522182115009192041e-01Q,
  826. 5.77662930241222967723689841612654067e-01Q,
  827. 6.73566368473468364485120633247622176e-01Q,
  828. 7.59259263037357630577282865204360976e-01Q,
  829. 8.33442628760834001421021108693569569e-01Q,
  830. 8.94991997878275368851042006782804954e-01Q,
  831. 9.42974571228974339414011169658470532e-01Q,
  832. 9.76663921459517511498315386479594068e-01Q,
  833. 9.95556969790498097908784946893901617e-01Q,
  834. };
  835. return data;
  836. }
  837. static std::array<T, 13> const & weights()
  838. {
  839. static const std::array<T, 13> data = {
  840. 1.23176053726715451203902873079050142e-01Q,
  841. 1.22242442990310041688959518945851506e-01Q,
  842. 1.19455763535784772228178126512901047e-01Q,
  843. 1.14858259145711648339325545869555809e-01Q,
  844. 1.08519624474263653116093957050116619e-01Q,
  845. 1.00535949067050644202206890392685827e-01Q,
  846. 9.10282619829636498114972207028916534e-02Q,
  847. 8.01407003350010180132349596691113023e-02Q,
  848. 6.80383338123569172071871856567079686e-02Q,
  849. 5.49046959758351919259368915404733242e-02Q,
  850. 4.09391567013063126556234877116459537e-02Q,
  851. 2.63549866150321372619018152952991449e-02Q,
  852. 1.13937985010262879479029641132347736e-02Q,
  853. };
  854. return data;
  855. }
  856. };
  857. #endif
  858. template <class T>
  859. class gauss_detail<T, 25, 4>
  860. {
  861. public:
  862. static std::array<T, 13> const & abscissa()
  863. {
  864. static std::array<T, 13> data = {
  865. BOOST_MATH_HUGE_CONSTANT(T, 0, 0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e+00),
  866. BOOST_MATH_HUGE_CONSTANT(T, 0, 1.2286469261071039638735981880803680553220534604978373842389353789270883496885841582643884994633105537597765980412320e-01),
  867. BOOST_MATH_HUGE_CONSTANT(T, 0, 2.4386688372098843204519036279745158640563315632598447642113565325038747278585595067977636776325034060327548499765742e-01),
  868. BOOST_MATH_HUGE_CONSTANT(T, 0, 3.6117230580938783773582173012764066742207834704337506979457877784674538239569654860329531506093761400789294612122812e-01),
  869. BOOST_MATH_HUGE_CONSTANT(T, 0, 4.7300273144571496052218211500919204133181773846162729090723082769560327584128603010315684778279363544192787010704498e-01),
  870. BOOST_MATH_HUGE_CONSTANT(T, 0, 5.7766293024122296772368984161265406739573503929151825664548350776102301275263202227671659646579649084013116066120581e-01),
  871. BOOST_MATH_HUGE_CONSTANT(T, 0, 6.7356636847346836448512063324762217588341672807274931705965696177828773684928421158196368568030932194044282149314388e-01),
  872. BOOST_MATH_HUGE_CONSTANT(T, 0, 7.5925926303735763057728286520436097638752201889833412091838973544501862882026240760763679724185230331463919586229073e-01),
  873. BOOST_MATH_HUGE_CONSTANT(T, 0, 8.3344262876083400142102110869356956946096411382352078602086471546171813247709012525322973947759168107133491065937347e-01),
  874. BOOST_MATH_HUGE_CONSTANT(T, 0, 8.9499199787827536885104200678280495417455484975358390306170168295917151090119945137118600693039178162093726882638296e-01),
  875. BOOST_MATH_HUGE_CONSTANT(T, 0, 9.4297457122897433941401116965847053190520157060899014192745249713729532254404926130890521815127348327109666786665572e-01),
  876. BOOST_MATH_HUGE_CONSTANT(T, 0, 9.7666392145951751149831538647959406774537055531440674467098742731616386753588055389644670948300617866819865983054648e-01),
  877. BOOST_MATH_HUGE_CONSTANT(T, 0, 9.9555696979049809790878494689390161725756264940480817121080493113293348134372793448728802635294700756868258870429256e-01),
  878. };
  879. return data;
  880. }
  881. static std::array<T, 13> const & weights()
  882. {
  883. static std::array<T, 13> data = {
  884. BOOST_MATH_HUGE_CONSTANT(T, 0, 1.2317605372671545120390287307905014243823362751815166539135219731691200794926142128460112517504958377310054583945994e-01),
  885. BOOST_MATH_HUGE_CONSTANT(T, 0, 1.2224244299031004168895951894585150583505924756305904090758008223203896721918010243033540891078906637115620156845304e-01),
  886. BOOST_MATH_HUGE_CONSTANT(T, 0, 1.1945576353578477222817812651290104739017670141372642551958788133518409022018773502442869720975271321374348568426235e-01),
  887. BOOST_MATH_HUGE_CONSTANT(T, 0, 1.1485825914571164833932554586955580864093619166818014959151499003148279667112542256534429898558156273250513652351744e-01),
  888. BOOST_MATH_HUGE_CONSTANT(T, 0, 1.0851962447426365311609395705011661934007758798672201615649430734883929279360844269339768350029654172135832773427565e-01),
  889. BOOST_MATH_HUGE_CONSTANT(T, 0, 1.0053594906705064420220689039268582698846609452814190706986904199941294815904602968195565620373258211755226681206658e-01),
  890. BOOST_MATH_HUGE_CONSTANT(T, 0, 9.1028261982963649811497220702891653380992558959334310970483768967017384678410526902484398142953718885872521590850372e-02),
  891. BOOST_MATH_HUGE_CONSTANT(T, 0, 8.0140700335001018013234959669111302290225732853675893716201462973612828934801289559457377714225318048243957479325813e-02),
  892. BOOST_MATH_HUGE_CONSTANT(T, 0, 6.8038333812356917207187185656707968554709494354636562615071226410003654051711473106651522969481873733098761760660898e-02),
  893. BOOST_MATH_HUGE_CONSTANT(T, 0, 5.4904695975835191925936891540473324160109985553111349048508498244593774678436511895711924079433444763756746828817613e-02),
  894. BOOST_MATH_HUGE_CONSTANT(T, 0, 4.0939156701306312655623487711645953660845783364104346504698414899297432880215512770478971055110424130123527015425511e-02),
  895. BOOST_MATH_HUGE_CONSTANT(T, 0, 2.6354986615032137261901815295299144935963281703322468755366165783870934008879499371529821528172928890350362464605104e-02),
  896. BOOST_MATH_HUGE_CONSTANT(T, 0, 1.1393798501026287947902964113234773603320526292909696448948061116189891729766743355923677112945033505688431618009664e-02),
  897. };
  898. return data;
  899. }
  900. };
  901. template <class T>
  902. class gauss_detail<T, 30, 0>
  903. {
  904. public:
  905. static std::array<T, 15> const & abscissa()
  906. {
  907. static constexpr std::array<T, 15> data = {
  908. 5.147184256e-02f,
  909. 1.538699136e-01f,
  910. 2.546369262e-01f,
  911. 3.527047255e-01f,
  912. 4.470337695e-01f,
  913. 5.366241481e-01f,
  914. 6.205261830e-01f,
  915. 6.978504948e-01f,
  916. 7.677774321e-01f,
  917. 8.295657624e-01f,
  918. 8.825605358e-01f,
  919. 9.262000474e-01f,
  920. 9.600218650e-01f,
  921. 9.836681233e-01f,
  922. 9.968934841e-01f,
  923. };
  924. return data;
  925. }
  926. static std::array<T, 15> const & weights()
  927. {
  928. static constexpr std::array<T, 15> data = {
  929. 1.028526529e-01f,
  930. 1.017623897e-01f,
  931. 9.959342059e-02f,
  932. 9.636873717e-02f,
  933. 9.212252224e-02f,
  934. 8.689978720e-02f,
  935. 8.075589523e-02f,
  936. 7.375597474e-02f,
  937. 6.597422988e-02f,
  938. 5.749315622e-02f,
  939. 4.840267283e-02f,
  940. 3.879919257e-02f,
  941. 2.878470788e-02f,
  942. 1.846646831e-02f,
  943. 7.968192496e-03f,
  944. };
  945. return data;
  946. }
  947. };
  948. template <class T>
  949. class gauss_detail<T, 30, 1>
  950. {
  951. public:
  952. static std::array<T, 15> const & abscissa()
  953. {
  954. static constexpr std::array<T, 15> data = {
  955. 5.14718425553176958e-02,
  956. 1.53869913608583547e-01,
  957. 2.54636926167889846e-01,
  958. 3.52704725530878113e-01,
  959. 4.47033769538089177e-01,
  960. 5.36624148142019899e-01,
  961. 6.20526182989242861e-01,
  962. 6.97850494793315797e-01,
  963. 7.67777432104826195e-01,
  964. 8.29565762382768397e-01,
  965. 8.82560535792052682e-01,
  966. 9.26200047429274326e-01,
  967. 9.60021864968307512e-01,
  968. 9.83668123279747210e-01,
  969. 9.96893484074649540e-01,
  970. };
  971. return data;
  972. }
  973. static std::array<T, 15> const & weights()
  974. {
  975. static constexpr std::array<T, 15> data = {
  976. 1.02852652893558840e-01,
  977. 1.01762389748405505e-01,
  978. 9.95934205867952671e-02,
  979. 9.63687371746442596e-02,
  980. 9.21225222377861287e-02,
  981. 8.68997872010829798e-02,
  982. 8.07558952294202154e-02,
  983. 7.37559747377052063e-02,
  984. 6.59742298821804951e-02,
  985. 5.74931562176190665e-02,
  986. 4.84026728305940529e-02,
  987. 3.87991925696270496e-02,
  988. 2.87847078833233693e-02,
  989. 1.84664683110909591e-02,
  990. 7.96819249616660562e-03,
  991. };
  992. return data;
  993. }
  994. };
  995. template <class T>
  996. class gauss_detail<T, 30, 2>
  997. {
  998. public:
  999. static std::array<T, 15> const & abscissa()
  1000. {
  1001. static constexpr std::array<T, 15> data = {
  1002. 5.14718425553176958330252131667225737e-02L,
  1003. 1.53869913608583546963794672743255920e-01L,
  1004. 2.54636926167889846439805129817805108e-01L,
  1005. 3.52704725530878113471037207089373861e-01L,
  1006. 4.47033769538089176780609900322854000e-01L,
  1007. 5.36624148142019899264169793311072794e-01L,
  1008. 6.20526182989242861140477556431189299e-01L,
  1009. 6.97850494793315796932292388026640068e-01L,
  1010. 7.67777432104826194917977340974503132e-01L,
  1011. 8.29565762382768397442898119732501916e-01L,
  1012. 8.82560535792052681543116462530225590e-01L,
  1013. 9.26200047429274325879324277080474004e-01L,
  1014. 9.60021864968307512216871025581797663e-01L,
  1015. 9.83668123279747209970032581605662802e-01L,
  1016. 9.96893484074649540271630050918695283e-01L,
  1017. };
  1018. return data;
  1019. }
  1020. static std::array<T, 15> const & weights()
  1021. {
  1022. static constexpr std::array<T, 15> data = {
  1023. 1.02852652893558840341285636705415044e-01L,
  1024. 1.01762389748405504596428952168554045e-01L,
  1025. 9.95934205867952670627802821035694765e-02L,
  1026. 9.63687371746442596394686263518098651e-02L,
  1027. 9.21225222377861287176327070876187672e-02L,
  1028. 8.68997872010829798023875307151257026e-02L,
  1029. 8.07558952294202153546949384605297309e-02L,
  1030. 7.37559747377052062682438500221907342e-02L,
  1031. 6.59742298821804951281285151159623612e-02L,
  1032. 5.74931562176190664817216894020561288e-02L,
  1033. 4.84026728305940529029381404228075178e-02L,
  1034. 3.87991925696270495968019364463476920e-02L,
  1035. 2.87847078833233693497191796112920436e-02L,
  1036. 1.84664683110909591423021319120472691e-02L,
  1037. 7.96819249616660561546588347467362245e-03L,
  1038. };
  1039. return data;
  1040. }
  1041. };
  1042. #ifdef BOOST_HAS_FLOAT128
  1043. template <class T>
  1044. class gauss_detail<T, 30, 3>
  1045. {
  1046. public:
  1047. static std::array<T, 15> const & abscissa()
  1048. {
  1049. static const std::array<T, 15> data = {
  1050. 5.14718425553176958330252131667225737e-02Q,
  1051. 1.53869913608583546963794672743255920e-01Q,
  1052. 2.54636926167889846439805129817805108e-01Q,
  1053. 3.52704725530878113471037207089373861e-01Q,
  1054. 4.47033769538089176780609900322854000e-01Q,
  1055. 5.36624148142019899264169793311072794e-01Q,
  1056. 6.20526182989242861140477556431189299e-01Q,
  1057. 6.97850494793315796932292388026640068e-01Q,
  1058. 7.67777432104826194917977340974503132e-01Q,
  1059. 8.29565762382768397442898119732501916e-01Q,
  1060. 8.82560535792052681543116462530225590e-01Q,
  1061. 9.26200047429274325879324277080474004e-01Q,
  1062. 9.60021864968307512216871025581797663e-01Q,
  1063. 9.83668123279747209970032581605662802e-01Q,
  1064. 9.96893484074649540271630050918695283e-01Q,
  1065. };
  1066. return data;
  1067. }
  1068. static std::array<T, 15> const & weights()
  1069. {
  1070. static const std::array<T, 15> data = {
  1071. 1.02852652893558840341285636705415044e-01Q,
  1072. 1.01762389748405504596428952168554045e-01Q,
  1073. 9.95934205867952670627802821035694765e-02Q,
  1074. 9.63687371746442596394686263518098651e-02Q,
  1075. 9.21225222377861287176327070876187672e-02Q,
  1076. 8.68997872010829798023875307151257026e-02Q,
  1077. 8.07558952294202153546949384605297309e-02Q,
  1078. 7.37559747377052062682438500221907342e-02Q,
  1079. 6.59742298821804951281285151159623612e-02Q,
  1080. 5.74931562176190664817216894020561288e-02Q,
  1081. 4.84026728305940529029381404228075178e-02Q,
  1082. 3.87991925696270495968019364463476920e-02Q,
  1083. 2.87847078833233693497191796112920436e-02Q,
  1084. 1.84664683110909591423021319120472691e-02Q,
  1085. 7.96819249616660561546588347467362245e-03Q,
  1086. };
  1087. return data;
  1088. }
  1089. };
  1090. #endif
  1091. template <class T>
  1092. class gauss_detail<T, 30, 4>
  1093. {
  1094. public:
  1095. static std::array<T, 15> const & abscissa()
  1096. {
  1097. static std::array<T, 15> data = {
  1098. BOOST_MATH_HUGE_CONSTANT(T, 0, 5.1471842555317695833025213166722573749141453666569564255160843987964755210427109055870090707285485841217089963590678e-02),
  1099. BOOST_MATH_HUGE_CONSTANT(T, 0, 1.5386991360858354696379467274325592041855197124433846171896298291578714851081610139692310651074078557990111754952062e-01),
  1100. BOOST_MATH_HUGE_CONSTANT(T, 0, 2.5463692616788984643980512981780510788278930330251842616428597508896353156907880290636628138423620257595521678255758e-01),
  1101. BOOST_MATH_HUGE_CONSTANT(T, 0, 3.5270472553087811347103720708937386065363100802142562659418446890026941623319107866436039675211352945165817827083104e-01),
  1102. BOOST_MATH_HUGE_CONSTANT(T, 0, 4.4703376953808917678060990032285400016240759386142440975447738172761535172858420700400688872124189834257262048739699e-01),
  1103. BOOST_MATH_HUGE_CONSTANT(T, 0, 5.3662414814201989926416979331107279416417800693029710545274348291201490861897837863114116009718990258091585830703557e-01),
  1104. BOOST_MATH_HUGE_CONSTANT(T, 0, 6.2052618298924286114047755643118929920736469282952813259505117012433531497488911774115258445532782106478789996137481e-01),
  1105. BOOST_MATH_HUGE_CONSTANT(T, 0, 6.9785049479331579693229238802664006838235380065395465637972284673997672124315996069538163644008904690545069439941341e-01),
  1106. BOOST_MATH_HUGE_CONSTANT(T, 0, 7.6777743210482619491797734097450313169488361723290845320649438736515857017299504505260960258623968420224697596501719e-01),
  1107. BOOST_MATH_HUGE_CONSTANT(T, 0, 8.2956576238276839744289811973250191643906869617034167880695298345365650658958163508295244350814016004371545455777732e-01),
  1108. BOOST_MATH_HUGE_CONSTANT(T, 0, 8.8256053579205268154311646253022559005668914714648423206832605312161626269519165572921583828573210485349058106849548e-01),
  1109. BOOST_MATH_HUGE_CONSTANT(T, 0, 9.2620004742927432587932427708047400408647453682532906091103713367942299565110232681677288015055886244486106298320068e-01),
  1110. BOOST_MATH_HUGE_CONSTANT(T, 0, 9.6002186496830751221687102558179766293035921740392339948566167242493995770706842922718944370380002378239172677454384e-01),
  1111. BOOST_MATH_HUGE_CONSTANT(T, 0, 9.8366812327974720997003258160566280194031785470971136351718001015114429536479104370207597166035471368057762560137209e-01),
  1112. BOOST_MATH_HUGE_CONSTANT(T, 0, 9.9689348407464954027163005091869528334088203811775079010809429780238769521016374081588201955806171741257405095963817e-01),
  1113. };
  1114. return data;
  1115. }
  1116. static std::array<T, 15> const & weights()
  1117. {
  1118. static std::array<T, 15> data = {
  1119. BOOST_MATH_HUGE_CONSTANT(T, 0, 1.0285265289355884034128563670541504386837555706492822258631898667601623865660942939262884632188870916503815852709086e-01),
  1120. BOOST_MATH_HUGE_CONSTANT(T, 0, 1.0176238974840550459642895216855404463270628948712684086426094541964251360531767494547599781978391198881693385887696e-01),
  1121. BOOST_MATH_HUGE_CONSTANT(T, 0, 9.9593420586795267062780282103569476529869263666704277221365146183946660389908809018092299289324184705373523229592037e-02),
  1122. BOOST_MATH_HUGE_CONSTANT(T, 0, 9.6368737174644259639468626351809865096406461430160245912994275732837534742003123724951247818104195363343093583583429e-02),
  1123. BOOST_MATH_HUGE_CONSTANT(T, 0, 9.2122522237786128717632707087618767196913234418234107527675047001973047070094168298464052916811907158954949394100501e-02),
  1124. BOOST_MATH_HUGE_CONSTANT(T, 0, 8.6899787201082979802387530715125702576753328743545344012222129882153582254261494247955033509639105330215477601953921e-02),
  1125. BOOST_MATH_HUGE_CONSTANT(T, 0, 8.0755895229420215354694938460529730875892803708439299890258593706051180567026345604212402769217808080749416147400962e-02),
  1126. BOOST_MATH_HUGE_CONSTANT(T, 0, 7.3755974737705206268243850022190734153770526037049438941269182374599399314635211710401352716638183270192254236882630e-02),
  1127. BOOST_MATH_HUGE_CONSTANT(T, 0, 6.5974229882180495128128515115962361237442953656660378967031516042143672466094179365819913911598737439478205808271237e-02),
  1128. BOOST_MATH_HUGE_CONSTANT(T, 0, 5.7493156217619066481721689402056128797120670721763134548715799003232147409954376925211999650950125355559974348279846e-02),
  1129. BOOST_MATH_HUGE_CONSTANT(T, 0, 4.8402672830594052902938140422807517815271809197372736345191936791805425677102152797767439563562263454374645955072007e-02),
  1130. BOOST_MATH_HUGE_CONSTANT(T, 0, 3.8799192569627049596801936446347692033200976766395352107732789705946970952769793919055026279035105656340228558382274e-02),
  1131. BOOST_MATH_HUGE_CONSTANT(T, 0, 2.8784707883323369349719179611292043639588894546287496474180122608145988940013933101730206711484171554940392262251283e-02),
  1132. BOOST_MATH_HUGE_CONSTANT(T, 0, 1.8466468311090959142302131912047269096206533968181403371298365514585599521307973654080519029675417955638095832046164e-02),
  1133. BOOST_MATH_HUGE_CONSTANT(T, 0, 7.9681924961666056154658834746736224504806965871517212294851633569200384329013332941536616922861735209846506562158817e-03),
  1134. };
  1135. return data;
  1136. }
  1137. };
  1138. }
  1139. template <class Real, unsigned N, class Policy = boost::math::policies::policy<> >
  1140. class gauss : public detail::gauss_detail<Real, N, detail::gauss_constant_category<Real>::value>
  1141. {
  1142. typedef detail::gauss_detail<Real, N, detail::gauss_constant_category<Real>::value> base;
  1143. public:
  1144. template <class F>
  1145. static auto integrate(F f, Real* pL1 = nullptr)->decltype(std::declval<F>()(std::declval<Real>()))
  1146. {
  1147. // In many math texts, K represents the field of real or complex numbers.
  1148. // Too bad we can't put blackboard bold into C++ source!
  1149. typedef decltype(f(Real(0))) K;
  1150. static_assert(!std::is_integral<K>::value,
  1151. "The return type cannot be integral, it must be either a real or complex floating point type.");
  1152. using std::abs;
  1153. unsigned non_zero_start = 1;
  1154. K result = Real(0);
  1155. if (N & 1) {
  1156. result = f(Real(0)) * base::weights()[0];
  1157. }
  1158. else {
  1159. result = 0;
  1160. non_zero_start = 0;
  1161. }
  1162. Real L1 = abs(result);
  1163. for (unsigned i = non_zero_start; i < base::abscissa().size(); ++i)
  1164. {
  1165. K fp = f(base::abscissa()[i]);
  1166. K fm = f(-base::abscissa()[i]);
  1167. result += (fp + fm) * base::weights()[i];
  1168. L1 += (abs(fp) + abs(fm)) * base::weights()[i];
  1169. }
  1170. if (pL1)
  1171. *pL1 = L1;
  1172. return result;
  1173. }
  1174. template <class F>
  1175. static auto integrate(F f, Real a, Real b, Real* pL1 = nullptr)->decltype(std::declval<F>()(std::declval<Real>()))
  1176. {
  1177. typedef decltype(f(a)) K;
  1178. static const char* function = "boost::math::quadrature::gauss<%1%>::integrate(f, %1%, %1%)";
  1179. if (!(boost::math::isnan)(a) && !(boost::math::isnan)(b))
  1180. {
  1181. // Infinite limits:
  1182. Real min_inf = -tools::max_value<Real>();
  1183. if ((a <= min_inf) && (b >= tools::max_value<Real>()))
  1184. {
  1185. auto u = [&](const Real& t)->K
  1186. {
  1187. Real t_sq = t*t;
  1188. Real inv = 1 / (1 - t_sq);
  1189. K res = f(t*inv)*(1 + t_sq)*inv*inv;
  1190. return res;
  1191. };
  1192. return integrate(u, pL1);
  1193. }
  1194. // Right limit is infinite:
  1195. if ((boost::math::isfinite)(a) && (b >= tools::max_value<Real>()))
  1196. {
  1197. auto u = [&](const Real& t)->K
  1198. {
  1199. Real z = 1 / (t + 1);
  1200. Real arg = 2 * z + a - 1;
  1201. K res = f(arg)*z*z;
  1202. return res;
  1203. };
  1204. K Q = Real(2) * integrate(u, pL1);
  1205. if (pL1)
  1206. {
  1207. *pL1 *= 2;
  1208. }
  1209. return Q;
  1210. }
  1211. if ((boost::math::isfinite)(b) && (a <= -tools::max_value<Real>()))
  1212. {
  1213. auto v = [&](const Real& t)->K
  1214. {
  1215. Real z = 1 / (t + 1);
  1216. Real arg = 2 * z - 1;
  1217. K res = f(b - arg) * z * z;
  1218. return res;
  1219. };
  1220. K Q = Real(2) * integrate(v, pL1);
  1221. if (pL1)
  1222. {
  1223. *pL1 *= 2;
  1224. }
  1225. return Q;
  1226. }
  1227. if ((boost::math::isfinite)(a) && (boost::math::isfinite)(b))
  1228. {
  1229. if (a == b)
  1230. {
  1231. return K(0);
  1232. }
  1233. if (b < a)
  1234. {
  1235. return -integrate(f, b, a, pL1);
  1236. }
  1237. Real avg = (a + b)*constants::half<Real>();
  1238. Real scale = (b - a)*constants::half<Real>();
  1239. auto u = [&](Real z)->K
  1240. {
  1241. return f(avg + scale*z);
  1242. };
  1243. K Q = scale*integrate(u, pL1);
  1244. if (pL1)
  1245. {
  1246. *pL1 *= scale;
  1247. }
  1248. return Q;
  1249. }
  1250. }
  1251. return static_cast<K>(policies::raise_domain_error(function, "The domain of integration is not sensible; please check the bounds.", a, Policy()));
  1252. }
  1253. };
  1254. } // namespace quadrature
  1255. } // namespace math
  1256. } // namespace boost
  1257. #ifdef _MSC_VER
  1258. #pragma warning(pop)
  1259. #endif
  1260. #endif // BOOST_MATH_QUADRATURE_GAUSS_HPP