x
Yes
No
Do you want to visit DriveHQ English website?
Inicio
Características
Precios
Prueba gratuita
Software cliente
Acerca de nosotros
Servidor de archivos
|
Solución de copias de seguridad
|
Servidor FTP
|
Servidor de correo electrónico
|
Alojamiento web
|
Software cliente
Servidor de archivos
Solución de copia de seguridad
Servidor FTP
Servidor de correo electrónico
Alojamiento web
Software cliente
lanczos.hpp - Hosted on DriveHQ Cloud IT Platform
Arriba
Subir
Descargar
Compartir
Publicar
Nueva carpeta
Nuevo archivo
Copiar
Cortar
Eliminar
Pegar
Clasificación
Actualizar
Ruta de la carpeta: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\math\special_functions\lanczos.hpp
Girar
Efecto
Propiedad
Historial
// (C) Copyright John Maddock 2006. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_MATH_SPECIAL_FUNCTIONS_LANCZOS #define BOOST_MATH_SPECIAL_FUNCTIONS_LANCZOS #include
#include
#include
#include
#include
#include
#include
#include
namespace boost{ namespace math{ namespace lanczos{ // // Individual lanczos approximations start here. // // Optimal values for G for each N are taken from // http://web.mala.bc.ca/pughg/phdThesis/phdThesis.pdf, // as are the theoretical error bounds. // // Constants calculated using the method described by Godfrey // http://my.fit.edu/~gabdo/gamma.txt and elaborated by Toth at // http://www.rskey.org/gamma.htm using NTL::RR at 1000 bit precision. // // Lanczos Coefficients for N=6 G=5.581 // Max experimental error (with arbitary precision arithmetic) 9.516e-12 // Generated with compiler: Microsoft Visual C++ version 8.0 on Win32 at Mar 23 2006 // struct lanczos6 : public mpl::int_<35> { // // Produces slightly better than float precision when evaluated at // double precision: // template
static T lanczos_sum(const T& z) { static const T num[6] = { static_cast
(8706.349592549009182288174442774377925882L), static_cast
(8523.650341121874633477483696775067709735L), static_cast
(3338.029219476423550899999750161289306564L), static_cast
(653.6424994294008795995653541449610986791L), static_cast
(63.99951844938187085666201263218840287667L), static_cast
(2.506628274631006311133031631822390264407L) }; static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint16_t) denom[6] = { static_cast
(0u), static_cast
(24u), static_cast
(50u), static_cast
(35u), static_cast
(10u), static_cast
(1u) }; return boost::math::tools::evaluate_rational(num, denom, z); } template
static T lanczos_sum_expG_scaled(const T& z) { static const T num[6] = { static_cast
(32.81244541029783471623665933780748627823L), static_cast
(32.12388941444332003446077108933558534361L), static_cast
(12.58034729455216106950851080138931470954L), static_cast
(2.463444478353241423633780693218408889251L), static_cast
(0.2412010548258800231126240760264822486599L), static_cast
(0.009446967704539249494420221613134244048319L) }; static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint16_t) denom[6] = { static_cast
(0u), static_cast
(24u), static_cast
(50u), static_cast
(35u), static_cast
(10u), static_cast
(1u) }; return boost::math::tools::evaluate_rational(num, denom, z); } template
static T lanczos_sum_near_1(const T& dz) { static const T d[5] = { static_cast
(2.044879010930422922760429926121241330235L), static_cast
(-2.751366405578505366591317846728753993668L), static_cast
(1.02282965224225004296750609604264824677L), static_cast
(-0.09786124911582813985028889636665335893627L), static_cast
(0.0009829742267506615183144364420540766510112L), }; T result = 0; for(unsigned k = 1; k <= sizeof(d)/sizeof(d[0]); ++k) { result += (-d[k-1]*dz)/(k*dz + k*k); } return result; } template
static T lanczos_sum_near_2(const T& dz) { static const T d[5] = { static_cast
(5.748142489536043490764289256167080091892L), static_cast
(-7.734074268282457156081021756682138251825L), static_cast
(2.875167944990511006997713242805893543947L), static_cast
(-0.2750873773533504542306766137703788781776L), static_cast
(0.002763134585812698552178368447708846850353L), }; T result = 0; T z = dz + 2; for(unsigned k = 1; k <= sizeof(d)/sizeof(d[0]); ++k) { result += (-d[k-1]*dz)/(z + k*z + k*k - 1); } return result; } static double g(){ return 5.581000000000000405009359383257105946541; } }; // // Lanczos Coefficients for N=11 G=10.900511 // Max experimental error (with arbitary precision arithmetic) 2.16676e-19 // Generated with compiler: Microsoft Visual C++ version 8.0 on Win32 at Mar 23 2006 // struct lanczos11 : public mpl::int_<60> { // // Produces slightly better than double precision when evaluated at // extended-double precision: // template
static T lanczos_sum(const T& z) { static const T num[11] = { static_cast
(38474670393.31776828316099004518914832218L), static_cast
(36857665043.51950660081971227404959150474L), static_cast
(15889202453.72942008945006665994637853242L), static_cast
(4059208354.298834770194507810788393801607L), static_cast
(680547661.1834733286087695557084801366446L), static_cast
(78239755.00312005289816041245285376206263L), static_cast
(6246580.776401795264013335510453568106366L), static_cast
(341986.3488721347032223777872763188768288L), static_cast
(12287.19451182455120096222044424100527629L), static_cast
(261.6140441641668190791708576058805625502L), static_cast
(2.506628274631000502415573855452633787834L) }; static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint32_t) denom[11] = { static_cast
(0u), static_cast
(362880u), static_cast
(1026576u), static_cast
(1172700u), static_cast
(723680u), static_cast
(269325u), static_cast
(63273u), static_cast
(9450u), static_cast
(870u), static_cast
(45u), static_cast
(1u) }; return boost::math::tools::evaluate_rational(num, denom, z); } template
static T lanczos_sum_expG_scaled(const T& z) { static const T num[11] = { static_cast
(709811.662581657956893540610814842699825L), static_cast
(679979.847415722640161734319823103390728L), static_cast
(293136.785721159725251629480984140341656L), static_cast
(74887.5403291467179935942448101441897121L), static_cast
(12555.29058241386295096255111537516768137L), static_cast
(1443.42992444170669746078056942194198252L), static_cast
(115.2419459613734722083208906727972935065L), static_cast
(6.30923920573262762719523981992008976989L), static_cast
(0.2266840463022436475495508977579735223818L), static_cast
(0.004826466289237661857584712046231435101741L), static_cast
(0.4624429436045378766270459638520555557321e-4L) }; static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint32_t) denom[11] = { static_cast
(0u), static_cast
(362880u), static_cast
(1026576u), static_cast
(1172700u), static_cast
(723680u), static_cast
(269325u), static_cast
(63273u), static_cast
(9450u), static_cast
(870u), static_cast
(45u), static_cast
(1u) }; return boost::math::tools::evaluate_rational(num, denom, z); } template
static T lanczos_sum_near_1(const T& dz) { static const T d[10] = { static_cast
(4.005853070677940377969080796551266387954L), static_cast
(-13.17044315127646469834125159673527183164L), static_cast
(17.19146865350790353683895137079288129318L), static_cast
(-11.36446409067666626185701599196274701126L), static_cast
(4.024801119349323770107694133829772634737L), static_cast
(-0.7445703262078094128346501724255463005006L), static_cast
(0.06513861351917497265045550019547857713172L), static_cast
(-0.00217899958561830354633560009312512312758L), static_cast
(0.17655204574495137651670832229571934738e-4L), static_cast
(-0.1036282091079938047775645941885460820853e-7L), }; T result = 0; for(unsigned k = 1; k <= sizeof(d)/sizeof(d[0]); ++k) { result += (-d[k-1]*dz)/(k*dz + k*k); } return result; } template
static T lanczos_sum_near_2(const T& dz) { static const T d[10] = { static_cast
(19.05889633808148715159575716844556056056L), static_cast
(-62.66183664701721716960978577959655644762L), static_cast
(81.7929198065004751699057192860287512027L), static_cast
(-54.06941772964234828416072865069196553015L), static_cast
(19.14904664790693019642068229478769661515L), static_cast
(-3.542488556926667589704590409095331790317L), static_cast
(0.3099140334815639910894627700232804503017L), static_cast
(-0.01036716187296241640634252431913030440825L), static_cast
(0.8399926504443119927673843789048514017761e-4L), static_cast
(-0.493038376656195010308610694048822561263e-7L), }; T result = 0; T z = dz + 2; for(unsigned k = 1; k <= sizeof(d)/sizeof(d[0]); ++k) { result += (-d[k-1]*dz)/(z + k*z + k*k - 1); } return result; } static double g(){ return 10.90051099999999983936049829935654997826; } }; // // Lanczos Coefficients for N=13 G=13.144565 // Max experimental error (with arbitary precision arithmetic) 9.2213e-23 // Generated with compiler: Microsoft Visual C++ version 8.0 on Win32 at Mar 23 2006 // struct lanczos13 : public mpl::int_<72> { // // Produces slightly better than extended-double precision when evaluated at // higher precision: // template
static T lanczos_sum(const T& z) { static const T num[13] = { static_cast
(44012138428004.60895436261759919070125699L), static_cast
(41590453358593.20051581730723108131357995L), static_cast
(18013842787117.99677796276038389462742949L), static_cast
(4728736263475.388896889723995205703970787L), static_cast
(837910083628.4046470415724300225777912264L), static_cast
(105583707273.4299344907359855510105321192L), static_cast
(9701363618.494999493386608345339104922694L), static_cast
(654914397.5482052641016767125048538245644L), static_cast
(32238322.94213356530668889463945849409184L), static_cast
(1128514.219497091438040721811544858643121L), static_cast
(26665.79378459858944762533958798805525125L), static_cast
(381.8801248632926870394389468349331394196L), static_cast
(2.506628274631000502415763426076722427007L) }; static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint32_t) denom[13] = { static_cast
(0u), static_cast
(39916800u), static_cast
(120543840u), static_cast
(150917976u), static_cast
(105258076u), static_cast
(45995730u), static_cast
(13339535u), static_cast
(2637558u), static_cast
(357423u), static_cast
(32670u), static_cast
(1925u), static_cast
(66u), static_cast
(1u) }; return boost::math::tools::evaluate_rational(num, denom, z); } template
static T lanczos_sum_expG_scaled(const T& z) { static const T num[13] = { static_cast
(86091529.53418537217994842267760536134841L), static_cast
(81354505.17858011242874285785316135398567L), static_cast
(35236626.38815461910817650960734605416521L), static_cast
(9249814.988024471294683815872977672237195L), static_cast
(1639024.216687146960253839656643518985826L), static_cast
(206530.8157641225032631778026076868855623L), static_cast
(18976.70193530288915698282139308582105936L), static_cast
(1281.068909912559479885759622791374106059L), static_cast
(63.06093343420234536146194868906771599354L), static_cast
(2.207470909792527638222674678171050209691L), static_cast
(0.05216058694613505427476207805814960742102L), static_cast
(0.0007469903808915448316510079585999893674101L), static_cast
(0.4903180573459871862552197089738373164184e-5L) }; static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint32_t) denom[13] = { static_cast
(0u), static_cast
(39916800u), static_cast
(120543840u), static_cast
(150917976u), static_cast
(105258076u), static_cast
(45995730u), static_cast
(13339535u), static_cast
(2637558u), static_cast
(357423u), static_cast
(32670u), static_cast
(1925u), static_cast
(66u), static_cast
(1u) }; return boost::math::tools::evaluate_rational(num, denom, z); } template
static T lanczos_sum_near_1(const T& dz) { static const T d[12] = { static_cast
(4.832115561461656947793029596285626840312L), static_cast
(-19.86441536140337740383120735104359034688L), static_cast
(33.9927422807443239927197864963170585331L), static_cast
(-31.41520692249765980987427413991250886138L), static_cast
(17.0270866009599345679868972409543597821L), static_cast
(-5.5077216950865501362506920516723682167L), static_cast
(1.037811741948214855286817963800439373362L), static_cast
(-0.106640468537356182313660880481398642811L), static_cast
(0.005276450526660653288757565778182586742831L), static_cast
(-0.0001000935625597121545867453746252064770029L), static_cast
(0.462590910138598083940803704521211569234e-6L), static_cast
(-0.1735307814426389420248044907765671743012e-9L), }; T result = 0; for(unsigned k = 1; k <= sizeof(d)/sizeof(d[0]); ++k) { result += (-d[k-1]*dz)/(k*dz + k*k); } return result; } template
static T lanczos_sum_near_2(const T& dz) { static const T d[12] = { static_cast
(26.96979819614830698367887026728396466395L), static_cast
(-110.8705424709385114023884328797900204863L), static_cast
(189.7258846119231466417015694690434770085L), static_cast
(-175.3397202971107486383321670769397356553L), static_cast
(95.03437648691551457087250340903980824948L), static_cast
(-30.7406022781665264273675797983497141978L), static_cast
(5.792405601630517993355102578874590410552L), static_cast
(-0.5951993240669148697377539518639997795831L), static_cast
(0.02944979359164017509944724739946255067671L), static_cast
(-0.0005586586555377030921194246330399163602684L), static_cast
(0.2581888478270733025288922038673392636029e-5L), static_cast
(-0.9685385411006641478305219367315965391289e-9L), }; T result = 0; T z = z = 2; for(unsigned k = 1; k <= sizeof(d)/sizeof(d[0]); ++k) { result += (-d[k-1]*dz)/(z + k*z + k*k - 1); } return result; } static double g(){ return 13.1445650000000000545696821063756942749; } }; // // Lanczos Coefficients for N=22 G=22.61891 // Max experimental error (with arbitary precision arithmetic) 2.9524e-38 // Generated with compiler: Microsoft Visual C++ version 8.0 on Win32 at Mar 23 2006 // struct lanczos22 : public mpl::int_<120> { // // Produces slightly better than 128-bit long-double precision when // evaluated at higher precision: // template
static T lanczos_sum(const T& z) { static const T num[22] = { static_cast
(46198410803245094237463011094.12173081986L), static_cast
(43735859291852324413622037436.321513777L), static_cast
(19716607234435171720534556386.97481377748L), static_cast
(5629401471315018442177955161.245623932129L), static_cast
(1142024910634417138386281569.245580222392L), static_cast
(175048529315951173131586747.695329230778L), static_cast
(21044290245653709191654675.41581372963167L), static_cast
(2033001410561031998451380.335553678782601L), static_cast
(160394318862140953773928.8736211601848891L), static_cast
(10444944438396359705707.48957290388740896L), static_cast
(565075825801617290121.1466393747967538948L), static_cast
(25475874292116227538.99448534450411942597L), static_cast
(957135055846602154.6720835535232270205725L), static_cast
(29874506304047462.23662392445173880821515L), static_cast
(769651310384737.2749087590725764959689181L), static_cast
(16193289100889.15989633624378404096011797L), static_cast
(273781151680.6807433264462376754578933261L), static_cast
(3630485900.32917021712188739762161583295L), static_cast
(36374352.05577334277856865691538582936484L), static_cast
(258945.7742115532455441786924971194951043L), static_cast
(1167.501919472435718934219997431551246996L), static_cast
(2.50662827463100050241576528481104525333L) }; static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint64_t) denom[22] = { (0uLL), (2432902008176640000uLL), (8752948036761600000uLL), (13803759753640704000uLL), (12870931245150988800uLL), (8037811822645051776uLL), (3599979517947607200uLL), (1206647803780373360uLL), (311333643161390640uLL), (63030812099294896uLL), (10142299865511450uLL), (1307535010540395uLL), (135585182899530uLL), (11310276995381uLL), (756111184500uLL), (40171771630uLL), (1672280820uLL), (53327946uLL), (1256850uLL), (20615uLL), (210uLL), (1uLL) }; return boost::math::tools::evaluate_rational(num, denom, z); } template
static T lanczos_sum_expG_scaled(const T& z) { static const T num[22] = { static_cast
(6939996264376682180.277485395074954356211L), static_cast
(6570067992110214451.87201438870245659384L), static_cast
(2961859037444440551.986724631496417064121L), static_cast
(845657339772791245.3541226499766163431651L), static_cast
(171556737035449095.2475716923888737881837L), static_cast
(26296059072490867.7822441885603400926007L), static_cast
(3161305619652108.433798300149816829198706L), static_cast
(305400596026022.4774396904484542582526472L), static_cast
(24094681058862.55120507202622377623528108L), static_cast
(1569055604375.919477574824168939428328839L), static_cast
(84886558909.02047889339710230696942513159L), static_cast
(3827024985.166751989686050643579753162298L), static_cast
(143782298.9273215199098728674282885500522L), static_cast
(4487794.24541641841336786238909171265944L), static_cast
(115618.2025760830513505888216285273541959L), static_cast
(2432.580773108508276957461757328744780439L), static_cast
(41.12782532742893597168530008461874360191L), static_cast
(0.5453771709477689805460179187388702295792L), static_cast
(0.005464211062612080347167337964166505282809L), static_cast
(0.388992321263586767037090706042788910953e-4L), static_cast
(0.1753839324538447655939518484052327068859e-6L), static_cast
(0.3765495513732730583386223384116545391759e-9L) }; static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint64_t) denom[22] = { (0uLL), (2432902008176640000uLL), (8752948036761600000uLL), (13803759753640704000uLL), (12870931245150988800uLL), (8037811822645051776uLL), (3599979517947607200uLL), (1206647803780373360uLL), (311333643161390640uLL), (63030812099294896uLL), (10142299865511450uLL), (1307535010540395uLL), (135585182899530uLL), (11310276995381uLL), (756111184500uLL), (40171771630uLL), (1672280820uLL), (53327946uLL), (1256850uLL), (20615uLL), (210uLL), (1uLL) }; return boost::math::tools::evaluate_rational(num, denom, z); } template
static T lanczos_sum_near_1(const T& dz) { static const T d[21] = { static_cast
(8.318998691953337183034781139546384476554L), static_cast
(-63.15415991415959158214140353299240638675L), static_cast
(217.3108224383632868591462242669081540163L), static_cast
(-448.5134281386108366899784093610397354889L), static_cast